Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/convert/hg.py @ 5014:914054ca532e
convert: acquire/release locks periodically
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 26 Jul 2007 13:34:36 -0700 |
parents | 6c1029aacc9a |
children | 4ebc8693ce72 |
comparison
equal
deleted
inserted
replaced
5013:6c1029aacc9a | 5014:914054ca532e |
---|---|
6 # thus have different hashes for changesets that are otherwise | 6 # thus have different hashes for changesets that are otherwise |
7 # identical. | 7 # identical. |
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 |
16 class mercurial_sink(converter_sink): | 17 class mercurial_sink(converter_sink): |
17 def __init__(self, ui, path): | 18 def __init__(self, ui, path): |
19 self.ui = ui | 20 self.ui = ui |
20 try: | 21 try: |
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") |
27 | 38 |
28 def authorfile(self): | 39 def authorfile(self): |
70 while parents: | 81 while parents: |
71 p1 = p2 | 82 p1 = p2 |
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 |
78 return p2 | 90 return p2 |
79 | 91 |