Mercurial > hg
comparison hgext/convert/convcmd.py @ 16105:ebaa0aa749e2 stable
convert: turn splicemap into a simple dictionary
Parsing the splicemap as a mapfile was a pain because map does not let us
override its parsing code and splicemap entries are not key/values. Besides we
had no need for mapfiles extra features. Just parse the splicemap and return a
dictionary.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Fri, 10 Feb 2012 22:25:49 +0100 |
parents | 9ff22f600c6c |
children | d75aa756149b |
comparison
equal
deleted
inserted
replaced
16103:3e1efb458e8b | 16105:ebaa0aa749e2 |
---|---|
13 from subversion import svn_source, svn_sink | 13 from subversion import svn_source, svn_sink |
14 from monotone import monotone_source | 14 from monotone import monotone_source |
15 from gnuarch import gnuarch_source | 15 from gnuarch import gnuarch_source |
16 from bzr import bzr_source | 16 from bzr import bzr_source |
17 from p4 import p4_source | 17 from p4 import p4_source |
18 import filemap | 18 import filemap, common |
19 | 19 |
20 import os, shutil | 20 import os, shutil |
21 from mercurial import hg, util, encoding | 21 from mercurial import hg, util, encoding |
22 from mercurial.i18n import _ | 22 from mercurial.i18n import _ |
23 | 23 |
116 # Extend/Override with new author map if necessary | 116 # Extend/Override with new author map if necessary |
117 if opts.get('authormap'): | 117 if opts.get('authormap'): |
118 self.readauthormap(opts.get('authormap')) | 118 self.readauthormap(opts.get('authormap')) |
119 self.authorfile = self.dest.authorfile() | 119 self.authorfile = self.dest.authorfile() |
120 | 120 |
121 self.splicemap = mapfile(ui, opts.get('splicemap')) | 121 self.splicemap = common.parsesplicemap(opts.get('splicemap')) |
122 self.branchmap = mapfile(ui, opts.get('branchmap')) | 122 self.branchmap = mapfile(ui, opts.get('branchmap')) |
123 | 123 |
124 def walktree(self, heads): | 124 def walktree(self, heads): |
125 '''Return a mapping that identifies the uncommitted parents of every | 125 '''Return a mapping that identifies the uncommitted parents of every |
126 uncommitted changeset.''' | 126 uncommitted changeset.''' |
317 self.cachecommit(prev) | 317 self.cachecommit(prev) |
318 pbranches.append((self.map[prev], | 318 pbranches.append((self.map[prev], |
319 self.commitcache[prev].branch)) | 319 self.commitcache[prev].branch)) |
320 self.dest.setbranch(commit.branch, pbranches) | 320 self.dest.setbranch(commit.branch, pbranches) |
321 try: | 321 try: |
322 parents = self.splicemap[rev].replace(',', ' ').split() | 322 parents = self.splicemap[rev] |
323 self.ui.status(_('spliced in %s as parents of %s\n') % | 323 self.ui.status(_('spliced in %s as parents of %s\n') % |
324 (parents, rev)) | 324 (parents, rev)) |
325 parents = [self.map.get(p, p) for p in parents] | 325 parents = [self.map.get(p, p) for p in parents] |
326 except KeyError: | 326 except KeyError: |
327 parents = [b[0] for b in pbranches] | 327 parents = [b[0] for b in pbranches] |