Show More
@@ -85,6 +85,10 b' def convert(ui, src, dest=None, revmapfi' | |||||
85 | Mercurial Source |
|
85 | Mercurial Source | |
86 | ----------------- |
|
86 | ----------------- | |
87 |
|
87 | |||
|
88 | --config convert.hg.ignoreerrors=False (boolean) | |||
|
89 | ignore integrity errors when reading. Use it to fix Mercurial | |||
|
90 | repositories with missing revlogs, by converting from and to | |||
|
91 | Mercurial. | |||
88 | --config convert.hg.saverev=True (boolean) |
|
92 | --config convert.hg.saverev=True (boolean) | |
89 | allow target to preserve source revision ID |
|
93 | allow target to preserve source revision ID | |
90 | --config convert.hg.startrev=0 (hg revision identifier) |
|
94 | --config convert.hg.startrev=0 (hg revision identifier) |
@@ -192,6 +192,8 b' class mercurial_sink(converter_sink):' | |||||
192 | class mercurial_source(converter_source): |
|
192 | class mercurial_source(converter_source): | |
193 | def __init__(self, ui, path, rev=None): |
|
193 | def __init__(self, ui, path, rev=None): | |
194 | converter_source.__init__(self, ui, path, rev) |
|
194 | converter_source.__init__(self, ui, path, rev) | |
|
195 | self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False) | |||
|
196 | self.ignored = {} | |||
195 | self.saverev = ui.configbool('convert', 'hg.saverev', True) |
|
197 | self.saverev = ui.configbool('convert', 'hg.saverev', True) | |
196 | try: |
|
198 | try: | |
197 | self.repo = hg.repository(self.ui, path) |
|
199 | self.repo = hg.repository(self.ui, path) | |
@@ -253,23 +255,35 b' class mercurial_source(converter_source)' | |||||
253 | parents = self.parents(ctx) |
|
255 | parents = self.parents(ctx) | |
254 | if not parents: |
|
256 | if not parents: | |
255 | files = util.sort(ctx.manifest().keys()) |
|
257 | files = util.sort(ctx.manifest().keys()) | |
256 | return [(f, rev) for f in files], {} |
|
258 | return [(f, rev) for f in files if f not in self.ignored], {} | |
257 | if self._changescache and self._changescache[0] == rev: |
|
259 | if self._changescache and self._changescache[0] == rev: | |
258 | m, a, r = self._changescache[1] |
|
260 | m, a, r = self._changescache[1] | |
259 | else: |
|
261 | else: | |
260 | m, a, r = self.repo.status(parents[0], ctx.node())[:3] |
|
262 | m, a, r = self.repo.status(parents[0], ctx.node())[:3] | |
261 | changes = [(name, rev) for name in m + a + r] |
|
263 | # getcopies() detects missing revlogs early, run it before | |
262 | return util.sort(changes), self.getcopies(ctx, m + a) |
|
264 | # filtering the changes. | |
|
265 | copies = self.getcopies(ctx, m + a) | |||
|
266 | changes = [(name, rev) for name in m + a + r | |||
|
267 | if name not in self.ignored] | |||
|
268 | return util.sort(changes), copies | |||
263 |
|
269 | |||
264 | def getcopies(self, ctx, files): |
|
270 | def getcopies(self, ctx, files): | |
265 | copies = {} |
|
271 | copies = {} | |
266 | for name in files: |
|
272 | for name in files: | |
|
273 | if name in self.ignored: | |||
|
274 | continue | |||
267 | try: |
|
275 | try: | |
268 |
copynode = ctx.filectx(name).renamed() |
|
276 | copysource, copynode = ctx.filectx(name).renamed() | |
269 | if self.keep(copynode): |
|
277 | if copysource in self.ignored or not self.keep(copynode): | |
270 |
co |
|
278 | continue | |
|
279 | copies[name] = copysource | |||
271 | except TypeError: |
|
280 | except TypeError: | |
272 | pass |
|
281 | pass | |
|
282 | except revlog.LookupError, e: | |||
|
283 | if not self.ignoreerrors: | |||
|
284 | raise | |||
|
285 | self.ignored[name] = 1 | |||
|
286 | self.ui.warn(_('ignoring: %s\n') % e) | |||
273 | return copies |
|
287 | return copies | |
274 |
|
288 | |||
275 | def getcommit(self, rev): |
|
289 | def getcommit(self, rev): | |
@@ -297,6 +311,7 b' class mercurial_source(converter_source)' | |||||
297 | else: |
|
311 | else: | |
298 | i = i or 0 |
|
312 | i = i or 0 | |
299 | changes = self.repo.status(parents[i], ctx.node())[:3] |
|
313 | changes = self.repo.status(parents[i], ctx.node())[:3] | |
|
314 | changes = [[f for f in l if f not in self.ignored] for l in changes] | |||
300 |
|
315 | |||
301 | if i == 0: |
|
316 | if i == 0: | |
302 | self._changescache = (rev, changes) |
|
317 | self._changescache = (rev, changes) |
@@ -36,5 +36,34 b' cd ..' | |||||
36 | hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
36 | hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' | |
37 | cd new |
|
37 | cd new | |
38 | hg out ../orig |
|
38 | hg out ../orig | |
|
39 | cd .. | |||
|
40 | ||||
|
41 | echo % init broken repository | |||
|
42 | hg init broken | |||
|
43 | cd broken | |||
|
44 | echo a >> a | |||
|
45 | echo b >> b | |||
|
46 | hg ci -qAm init | |||
|
47 | echo a >> a | |||
|
48 | echo b >> b | |||
|
49 | hg copy b c | |||
|
50 | hg ci -qAm changeall | |||
|
51 | hg up -qC 0 | |||
|
52 | echo bc >> b | |||
|
53 | hg ci -m changebagain | |||
|
54 | HGMERGE=internal:local hg -q merge | |||
|
55 | hg ci -m merge | |||
|
56 | hg mv b d | |||
|
57 | hg ci -m moveb | |||
|
58 | echo % break it | |||
|
59 | rm .hg/store/data/b.* | |||
|
60 | cd .. | |||
|
61 | ||||
|
62 | hg --config convert.hg.ignoreerrors=True convert broken fixed | |||
|
63 | hg -R fixed verify | |||
|
64 | echo '% manifest -r 0' | |||
|
65 | hg -R fixed manifest -r 0 | |||
|
66 | echo '% manifest -r tip' | |||
|
67 | hg -R fixed manifest -r tip | |||
39 |
|
68 | |||
40 | true |
|
69 | true |
@@ -20,3 +20,27 b' 0 mark baz executable' | |||||
20 | comparing with ../orig |
|
20 | comparing with ../orig | |
21 | searching for changes |
|
21 | searching for changes | |
22 | no changes found |
|
22 | no changes found | |
|
23 | % init broken repository | |||
|
24 | created new head | |||
|
25 | % break it | |||
|
26 | initializing destination fixed repository | |||
|
27 | scanning source... | |||
|
28 | sorting... | |||
|
29 | converting... | |||
|
30 | 4 init | |||
|
31 | 3 changebagain | |||
|
32 | ignoring: data/b.i@4b3c32ced4f8: no match found | |||
|
33 | 2 changeall | |||
|
34 | 1 merge | |||
|
35 | 0 moveb | |||
|
36 | checking changesets | |||
|
37 | checking manifests | |||
|
38 | crosschecking files in changesets and manifests | |||
|
39 | checking files | |||
|
40 | 3 files, 5 changesets, 5 total revisions | |||
|
41 | % manifest -r 0 | |||
|
42 | a | |||
|
43 | % manifest -r tip | |||
|
44 | a | |||
|
45 | c | |||
|
46 | d |
@@ -72,6 +72,10 b' Convert a foreign SCM repository to a Me' | |||||
72 | Mercurial Source |
|
72 | Mercurial Source | |
73 | ----------------- |
|
73 | ----------------- | |
74 |
|
74 | |||
|
75 | --config convert.hg.ignoreerrors=False (boolean) | |||
|
76 | ignore integrity errors when reading. Use it to fix Mercurial | |||
|
77 | repositories with missing revlogs, by converting from and to | |||
|
78 | Mercurial. | |||
75 | --config convert.hg.saverev=True (boolean) |
|
79 | --config convert.hg.saverev=True (boolean) | |
76 | allow target to preserve source revision ID |
|
80 | allow target to preserve source revision ID | |
77 | --config convert.hg.startrev=0 (hg revision identifier) |
|
81 | --config convert.hg.startrev=0 (hg revision identifier) |
General Comments 0
You need to be logged in to leave comments.
Login now