Show More
@@ -41,25 +41,25 b' def convertsink(ui, path):' | |||
|
41 | 41 | raise util.Abort('%s: unknown repository type' % path) |
|
42 | 42 | |
|
43 | 43 | class convert(object): |
|
44 | def __init__(self, ui, source, dest, mapfile, opts): | |
|
44 | def __init__(self, ui, source, dest, revmapfile, opts): | |
|
45 | 45 | |
|
46 | 46 | self.source = source |
|
47 | 47 | self.dest = dest |
|
48 | 48 | self.ui = ui |
|
49 | 49 | self.opts = opts |
|
50 | 50 | self.commitcache = {} |
|
51 | self.mapfile = mapfile | |
|
52 | self.mapfilefd = None | |
|
51 | self.revmapfile = revmapfile | |
|
52 | self.revmapfilefd = None | |
|
53 | 53 | self.authors = {} |
|
54 | 54 | self.authorfile = None |
|
55 | 55 | |
|
56 | 56 | self.map = {} |
|
57 | 57 | try: |
|
58 | origmapfile = open(self.mapfile, 'r') | |
|
59 | for l in origmapfile: | |
|
58 | origrevmapfile = open(self.revmapfile, 'r') | |
|
59 | for l in origrevmapfile: | |
|
60 | 60 | sv, dv = l[:-1].split() |
|
61 | 61 | self.map[sv] = dv |
|
62 | origmapfile.close() | |
|
62 | origrevmapfile.close() | |
|
63 | 63 | except IOError: |
|
64 | 64 | pass |
|
65 | 65 | |
@@ -151,14 +151,14 b' class convert(object):' | |||
|
151 | 151 | return s |
|
152 | 152 | |
|
153 | 153 | def mapentry(self, src, dst): |
|
154 | if self.mapfilefd is None: | |
|
154 | if self.revmapfilefd is None: | |
|
155 | 155 | try: |
|
156 | self.mapfilefd = open(self.mapfile, "a") | |
|
156 | self.revmapfilefd = open(self.revmapfile, "a") | |
|
157 | 157 | except IOError, (errno, strerror): |
|
158 | raise util.Abort("Could not open map file %s: %s, %s\n" % (self.mapfile, errno, strerror)) | |
|
158 | raise util.Abort("Could not open map file %s: %s, %s\n" % (self.revmapfile, errno, strerror)) | |
|
159 | 159 | self.map[src] = dst |
|
160 | self.mapfilefd.write("%s %s\n" % (src, dst)) | |
|
161 | self.mapfilefd.flush() | |
|
160 | self.revmapfilefd.write("%s %s\n" % (src, dst)) | |
|
161 | self.revmapfilefd.flush() | |
|
162 | 162 | |
|
163 | 163 | def writeauthormap(self): |
|
164 | 164 | authorfile = self.authorfile |
@@ -256,10 +256,10 b' class convert(object):' | |||
|
256 | 256 | self.cleanup() |
|
257 | 257 | |
|
258 | 258 | def cleanup(self): |
|
259 | if self.mapfilefd: | |
|
260 | self.mapfilefd.close() | |
|
259 | if self.revmapfilefd: | |
|
260 | self.revmapfilefd.close() | |
|
261 | 261 | |
|
262 | def _convert(ui, src, dest=None, mapfile=None, **opts): | |
|
262 | def _convert(ui, src, dest=None, revmapfile=None, **opts): | |
|
263 | 263 | """Convert a foreign SCM repository to a Mercurial one. |
|
264 | 264 | |
|
265 | 265 | Accepted source formats: |
@@ -278,8 +278,8 b' def _convert(ui, src, dest=None, mapfile' | |||
|
278 | 278 | basename of the source with '-hg' appended. If the destination |
|
279 | 279 | repository doesn't exist, it will be created. |
|
280 | 280 | |
|
281 | If <mapfile> isn't given, it will be put in a default location | |
|
282 | (<dest>/.hg/shamap by default). The <mapfile> is a simple text | |
|
281 | If <revmapfile> isn't given, it will be put in a default location | |
|
282 | (<dest>/.hg/shamap by default). The <revmapfile> is a simple text | |
|
283 | 283 | file that maps each source commit ID to the destination ID for |
|
284 | 284 | that revision, like so: |
|
285 | 285 | <source ID> <destination ID> |
@@ -334,13 +334,13 b' def _convert(ui, src, dest=None, mapfile' | |||
|
334 | 334 | shutil.rmtree(dest, True) |
|
335 | 335 | raise |
|
336 | 336 | |
|
337 | if not mapfile: | |
|
337 | if not revmapfile: | |
|
338 | 338 | try: |
|
339 | mapfile = destc.mapfile() | |
|
339 | revmapfile = destc.revmapfile() | |
|
340 | 340 | except: |
|
341 | mapfile = os.path.join(destc, "map") | |
|
341 | revmapfile = os.path.join(destc, "map") | |
|
342 | 342 | |
|
343 | c = convert(ui, srcc, destc, mapfile, opts) | |
|
343 | c = convert(ui, srcc, destc, revmapfile, opts) | |
|
344 | 344 | c.convert() |
|
345 | 345 | |
|
346 | 346 | cmdtable = { |
@@ -81,7 +81,7 b' class converter_sink(object):' | |||
|
81 | 81 | """Return a list of this repository's heads""" |
|
82 | 82 | raise NotImplementedError() |
|
83 | 83 | |
|
84 | def mapfile(self): | |
|
84 | def revmapfile(self): | |
|
85 | 85 | """Path to a file that will contain lines |
|
86 | 86 | source_rev_id sink_rev_id |
|
87 | 87 | mapping equivalent revision identifiers for each system.""" |
General Comments 0
You need to be logged in to leave comments.
Login now