Show More
@@ -424,34 +424,6 b' class mapfile(dict):' | |||
|
424 | 424 | self.fp.close() |
|
425 | 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 | 427 | def makedatetimestamp(t): |
|
456 | 428 | """Like util.makedate() but for time t instead of current time""" |
|
457 | 429 | delta = (datetime.datetime.utcfromtimestamp(t) - |
@@ -15,7 +15,7 b' from monotone import monotone_source' | |||
|
15 | 15 | from gnuarch import gnuarch_source |
|
16 | 16 | from bzr import bzr_source |
|
17 | 17 | from p4 import p4_source |
|
18 |
import filemap |
|
|
18 | import filemap | |
|
19 | 19 | |
|
20 | 20 | import os, shutil |
|
21 | 21 | from mercurial import hg, util, encoding |
@@ -118,9 +118,39 b' class converter(object):' | |||
|
118 | 118 | self.readauthormap(opts.get('authormap')) |
|
119 | 119 | self.authorfile = self.dest.authorfile() |
|
120 | 120 | |
|
121 |
self.splicemap = |
|
|
121 | self.splicemap = self.parsesplicemap(opts.get('splicemap')) | |
|
122 | 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 | 154 | def walktree(self, heads): |
|
125 | 155 | '''Return a mapping that identifies the uncommitted parents of every |
|
126 | 156 | uncommitted changeset.''' |
General Comments 0
You need to be logged in to leave comments.
Login now