Show More
@@ -424,34 +424,6 b' class mapfile(dict):' | |||||
424 | self.fp.close() |
|
424 | self.fp.close() | |
425 | self.fp = None |
|
425 | self.fp = None | |
426 |
|
426 | |||
427 | def parsesplicemap(path): |
|
|||
428 | """Parse a splicemap, return a child/parents dictionary.""" |
|
|||
429 | if not path: |
|
|||
430 | return {} |
|
|||
431 | m = {} |
|
|||
432 | try: |
|
|||
433 | fp = open(path, 'r') |
|
|||
434 | for i, line in enumerate(fp): |
|
|||
435 | line = line.splitlines()[0].rstrip() |
|
|||
436 | if not line: |
|
|||
437 | # Ignore blank lines |
|
|||
438 | continue |
|
|||
439 | try: |
|
|||
440 | child, parents = line.split(' ', 1) |
|
|||
441 | parents = parents.replace(',', ' ').split() |
|
|||
442 | except ValueError: |
|
|||
443 | raise util.Abort(_('syntax error in %s(%d): child parent1' |
|
|||
444 | '[,parent2] expected') % (path, i + 1)) |
|
|||
445 | pp = [] |
|
|||
446 | for p in parents: |
|
|||
447 | if p not in pp: |
|
|||
448 | pp.append(p) |
|
|||
449 | m[child] = pp |
|
|||
450 | except IOError, e: |
|
|||
451 | if e.errno != errno.ENOENT: |
|
|||
452 | raise |
|
|||
453 | return m |
|
|||
454 |
|
||||
455 | def makedatetimestamp(t): |
|
427 | def makedatetimestamp(t): | |
456 | """Like util.makedate() but for time t instead of current time""" |
|
428 | """Like util.makedate() but for time t instead of current time""" | |
457 | delta = (datetime.datetime.utcfromtimestamp(t) - |
|
429 | delta = (datetime.datetime.utcfromtimestamp(t) - |
@@ -15,7 +15,7 b' 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 | |
19 |
|
19 | |||
20 | import os, shutil |
|
20 | import os, shutil | |
21 | from mercurial import hg, util, encoding |
|
21 | from mercurial import hg, util, encoding | |
@@ -118,9 +118,39 b' class converter(object):' | |||||
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 = |
|
121 | self.splicemap = self.parsesplicemap(opts.get('splicemap')) | |
122 | self.branchmap = mapfile(ui, opts.get('branchmap')) |
|
122 | self.branchmap = mapfile(ui, opts.get('branchmap')) | |
123 |
|
123 | |||
|
124 | ||||
|
125 | def parsesplicemap(self, path): | |||
|
126 | """Parse a splicemap, return a child/parents dictionary.""" | |||
|
127 | if not path: | |||
|
128 | return {} | |||
|
129 | m = {} | |||
|
130 | try: | |||
|
131 | fp = open(path, 'r') | |||
|
132 | for i, line in enumerate(fp): | |||
|
133 | line = line.splitlines()[0].rstrip() | |||
|
134 | if not line: | |||
|
135 | # Ignore blank lines | |||
|
136 | continue | |||
|
137 | try: | |||
|
138 | child, parents = line.split(' ', 1) | |||
|
139 | parents = parents.replace(',', ' ').split() | |||
|
140 | except ValueError: | |||
|
141 | raise util.Abort(_('syntax error in %s(%d): child parent1' | |||
|
142 | '[,parent2] expected') % (path, i + 1)) | |||
|
143 | pp = [] | |||
|
144 | for p in parents: | |||
|
145 | if p not in pp: | |||
|
146 | pp.append(p) | |||
|
147 | m[child] = pp | |||
|
148 | except IOError, e: | |||
|
149 | if e.errno != errno.ENOENT: | |||
|
150 | raise | |||
|
151 | return m | |||
|
152 | ||||
|
153 | ||||
124 | def walktree(self, heads): |
|
154 | def walktree(self, heads): | |
125 | '''Return a mapping that identifies the uncommitted parents of every |
|
155 | '''Return a mapping that identifies the uncommitted parents of every | |
126 | uncommitted changeset.''' |
|
156 | uncommitted changeset.''' |
General Comments 0
You need to be logged in to leave comments.
Login now