summaryrefslogtreecommitdiff
path: root/hgext/convert/convcmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'hgext/convert/convcmd.py')
-rw-r--r--hgext/convert/convcmd.py38
1 files changed, 7 insertions, 31 deletions
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
index c8fe845..578272a 100644
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -15,7 +15,7 @@ from monotone import monotone_source
from gnuarch import gnuarch_source
from bzr import bzr_source
from p4 import p4_source
-import filemap, common
+import filemap
import os, shutil
from mercurial import hg, util, encoding
@@ -118,7 +118,7 @@ class converter(object):
self.readauthormap(opts.get('authormap'))
self.authorfile = self.dest.authorfile()
- self.splicemap = common.parsesplicemap(opts.get('splicemap'))
+ self.splicemap = mapfile(ui, opts.get('splicemap'))
self.branchmap = mapfile(ui, opts.get('branchmap'))
def walktree(self, heads):
@@ -142,29 +142,6 @@ class converter(object):
return parents
- def mergesplicemap(self, parents, splicemap):
- """A splicemap redefines child/parent relationships. Check the
- map contains valid revision identifiers and merge the new
- links in the source graph.
- """
- for c in splicemap:
- if c not in parents:
- if not self.dest.hascommit(self.map.get(c, c)):
- # Could be in source but not converted during this run
- self.ui.warn(_('splice map revision %s is not being '
- 'converted, ignoring\n') % c)
- continue
- pc = []
- for p in splicemap[c]:
- # We do not have to wait for nodes already in dest.
- if self.dest.hascommit(self.map.get(p, p)):
- continue
- # Parent is not in dest and not being converted, not good
- if p not in parents:
- raise util.Abort(_('unknown splice map parent: %s') % p)
- pc.append(p)
- parents[c] = pc
-
def toposort(self, parents, sortmode):
'''Return an ordering such that every uncommitted changeset is
preceeded by all its uncommitted ancestors.'''
@@ -190,7 +167,7 @@ class converter(object):
children.setdefault(n, [])
hasparent = False
for p in parents[n]:
- if p not in self.map:
+ if not p in self.map:
visit.append(p)
hasparent = True
children.setdefault(p, []).append(n)
@@ -280,7 +257,7 @@ class converter(object):
def writeauthormap(self):
authorfile = self.authorfile
if authorfile:
- self.ui.status(_('writing author map file %s\n') % authorfile)
+ self.ui.status(_('Writing author map file %s\n') % authorfile)
ofile = open(authorfile, 'w+')
for author in self.authors:
ofile.write("%s=%s\n" % (author, self.authors[author]))
@@ -297,7 +274,7 @@ class converter(object):
try:
srcauthor, dstauthor = line.split('=', 1)
except ValueError:
- msg = _('ignoring bad line in author map file %s: %s\n')
+ msg = _('Ignoring bad line in author map file %s: %s\n')
self.ui.warn(msg % (authorfile, line.rstrip()))
continue
@@ -342,7 +319,7 @@ class converter(object):
self.commitcache[prev].branch))
self.dest.setbranch(commit.branch, pbranches)
try:
- parents = self.splicemap[rev]
+ parents = self.splicemap[rev].replace(',', ' ').split()
self.ui.status(_('spliced in %s as parents of %s\n') %
(parents, rev))
parents = [self.map.get(p, p) for p in parents]
@@ -363,7 +340,6 @@ class converter(object):
self.ui.status(_("scanning source...\n"))
heads = self.source.getheads()
parents = self.walktree(heads)
- self.mergesplicemap(parents, self.splicemap)
self.ui.status(_("sorting...\n"))
t = self.toposort(parents, sortmode)
num = len(t)
@@ -462,7 +438,7 @@ def convert(ui, src, dest=None, revmapfile=None, **opts):
if not revmapfile:
try:
revmapfile = destc.revmapfile()
- except Exception:
+ except:
revmapfile = os.path.join(destc, "map")
c = converter(ui, srcc, destc, revmapfile, opts)