Show More
@@ -217,6 +217,7 b' class convert(object):' | |||||
217 |
|
217 | |||
218 | def convert(self): |
|
218 | def convert(self): | |
219 | try: |
|
219 | try: | |
|
220 | self.dest.before() | |||
220 | self.source.setrevmap(self.map) |
|
221 | self.source.setrevmap(self.map) | |
221 | self.ui.status("scanning source...\n") |
|
222 | self.ui.status("scanning source...\n") | |
222 | heads = self.source.getheads() |
|
223 | heads = self.source.getheads() | |
@@ -257,8 +258,9 b' class convert(object):' | |||||
257 | self.cleanup() |
|
258 | self.cleanup() | |
258 |
|
259 | |||
259 | def cleanup(self): |
|
260 | def cleanup(self): | |
260 | if self.revmapfilefd: |
|
261 | self.dest.after() | |
261 |
|
|
262 | if self.revmapfilefd: | |
|
263 | self.revmapfilefd.close() | |||
262 |
|
264 | |||
263 | def _convert(ui, src, dest=None, revmapfile=None, **opts): |
|
265 | def _convert(ui, src, dest=None, revmapfile=None, **opts): | |
264 | """Convert a foreign SCM repository to a Mercurial one. |
|
266 | """Convert a foreign SCM repository to a Mercurial one. |
@@ -8,8 +8,9 b'' | |||||
8 |
|
8 | |||
9 |
|
9 | |||
10 | import os, time |
|
10 | import os, time | |
|
11 | from mercurial.i18n import _ | |||
11 | from mercurial.node import * |
|
12 | from mercurial.node import * | |
12 | from mercurial import hg, revlog, util |
|
13 | from mercurial import hg, lock, revlog, util | |
13 |
|
14 | |||
14 | from common import NoRepo, commit, converter_source, converter_sink |
|
15 | from common import NoRepo, commit, converter_source, converter_sink | |
15 |
|
16 | |||
@@ -21,6 +22,16 b' class mercurial_sink(converter_sink):' | |||||
21 | self.repo = hg.repository(self.ui, path) |
|
22 | self.repo = hg.repository(self.ui, path) | |
22 | except: |
|
23 | except: | |
23 | raise NoRepo("could not open hg repo %s as sink" % path) |
|
24 | raise NoRepo("could not open hg repo %s as sink" % path) | |
|
25 | self.lock = None | |||
|
26 | self.wlock = None | |||
|
27 | ||||
|
28 | def before(self): | |||
|
29 | self.lock = self.repo.lock() | |||
|
30 | self.wlock = self.repo.wlock() | |||
|
31 | ||||
|
32 | def after(self): | |||
|
33 | self.lock = None | |||
|
34 | self.wlock = None | |||
24 |
|
35 | |||
25 | def revmapfile(self): |
|
36 | def revmapfile(self): | |
26 | return os.path.join(self.path, ".hg", "shamap") |
|
37 | return os.path.join(self.path, ".hg", "shamap") | |
@@ -72,6 +83,7 b' class mercurial_sink(converter_sink):' | |||||
72 | p2 = parents.pop(0) |
|
83 | p2 = parents.pop(0) | |
73 | a = self.repo.rawcommit(files, text, commit.author, commit.date, |
|
84 | a = self.repo.rawcommit(files, text, commit.author, commit.date, | |
74 | hg.bin(p1), hg.bin(p2), extra=extra) |
|
85 | hg.bin(p1), hg.bin(p2), extra=extra) | |
|
86 | self.repo.dirstate.invalidate() | |||
75 | text = "(octopus merge fixup)\n" |
|
87 | text = "(octopus merge fixup)\n" | |
76 | p2 = hg.hex(self.repo.changelog.tip()) |
|
88 | p2 = hg.hex(self.repo.changelog.tip()) | |
77 |
|
89 |
General Comments 0
You need to be logged in to leave comments.
Login now