Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/convert/__init__.py @ 5375:dae323e453aa
convert: disable current --filemap support
The --filemap support in hg convert doesn't handle merges correctly.
(And after 33015dac5df5 I managed to break it even for simple cases
where we don't want the first revision.)
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 04 Oct 2007 23:21:37 -0300 |
parents | e710874247d1 |
children | d60a067227a5 |
comparison
equal
deleted
inserted
replaced
5374:e710874247d1 | 5375:dae323e453aa |
---|---|
38 except (AttributeError, NoRepo): | 38 except (AttributeError, NoRepo): |
39 pass | 39 pass |
40 raise util.Abort('%s: unknown repository type' % path) | 40 raise util.Abort('%s: unknown repository type' % path) |
41 | 41 |
42 class converter(object): | 42 class converter(object): |
43 def __init__(self, ui, source, dest, revmapfile, filemapper, opts): | 43 def __init__(self, ui, source, dest, revmapfile, opts): |
44 | 44 |
45 self.source = source | 45 self.source = source |
46 self.dest = dest | 46 self.dest = dest |
47 self.ui = ui | 47 self.ui = ui |
48 self.opts = opts | 48 self.opts = opts |
49 self.commitcache = {} | 49 self.commitcache = {} |
50 self.revmapfile = revmapfile | 50 self.revmapfile = revmapfile |
51 self.revmapfilefd = None | 51 self.revmapfilefd = None |
52 self.authors = {} | 52 self.authors = {} |
53 self.authorfile = None | 53 self.authorfile = None |
54 self.mapfile = filemapper | |
55 | 54 |
56 self.maporder = [] | 55 self.maporder = [] |
57 self.map = {} | 56 self.map = {} |
58 try: | 57 try: |
59 origrevmapfile = open(self.revmapfile, 'r') | 58 origrevmapfile = open(self.revmapfile, 'r') |
219 pbranch = self.commitcache[prev].branch | 218 pbranch = self.commitcache[prev].branch |
220 else: | 219 else: |
221 pbranch = None | 220 pbranch = None |
222 self.dest.setbranch(commit.branch, pbranch, parents) | 221 self.dest.setbranch(commit.branch, pbranch, parents) |
223 for f, v in files: | 222 for f, v in files: |
224 newf = self.mapfile(f) | 223 filenames.append(f) |
225 if not newf: | |
226 continue | |
227 filenames.append(newf) | |
228 try: | 224 try: |
229 data = self.source.getfile(f, v) | 225 data = self.source.getfile(f, v) |
230 except IOError, inst: | 226 except IOError, inst: |
231 self.dest.delfile(newf) | 227 self.dest.delfile(f) |
232 else: | 228 else: |
233 e = self.source.getmode(f, v) | 229 e = self.source.getmode(f, v) |
234 self.dest.putfile(newf, e, data) | 230 self.dest.putfile(f, e, data) |
235 if do_copies: | 231 if do_copies: |
236 if f in copies: | 232 if f in copies: |
237 copyf = self.mapfile(copies[f]) | 233 copyf = copies[f] |
238 if copyf: | 234 # Merely marks that a copy happened. |
239 # Merely marks that a copy happened. | 235 self.dest.copyfile(copyf, f) |
240 self.dest.copyfile(copyf, newf) | 236 |
241 | 237 newnode = self.dest.putcommit(filenames, parents, commit) |
242 if not filenames and self.mapfile.active(): | |
243 newnode = parents[0] | |
244 else: | |
245 newnode = self.dest.putcommit(filenames, parents, commit) | |
246 self.mapentry(rev, newnode) | 238 self.mapentry(rev, newnode) |
247 | 239 |
248 def convert(self): | 240 def convert(self): |
249 try: | 241 try: |
250 self.source.before() | 242 self.source.before() |
476 try: | 468 try: |
477 revmapfile = destc.revmapfile() | 469 revmapfile = destc.revmapfile() |
478 except: | 470 except: |
479 revmapfile = os.path.join(destc, "map") | 471 revmapfile = os.path.join(destc, "map") |
480 | 472 |
481 | 473 c = converter(ui, srcc, destc, revmapfile, opts) |
482 c = converter(ui, srcc, destc, revmapfile, filemapper(ui, opts['filemap']), | |
483 opts) | |
484 c.convert() | 474 c.convert() |
485 | 475 |
486 | 476 |
487 cmdtable = { | 477 cmdtable = { |
488 "convert": | 478 "convert": |