Mercurial > hg > hg-git
changeset 1026:e7a8a5710257
wlock: use non-context-manager form to restore older hg support
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Mon, 24 Jul 2017 15:07:44 -0500 |
parents | 078c3912afce |
children | 620a1095f3a9 |
files | hggit/__init__.py hggit/git_handler.py |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -270,9 +270,12 @@ gitsha, hgsha = line.strip().split(' ', 1) if hgsha in repo: new_map.append('%s %s\n' % (gitsha, hgsha)) - with repo.wlock(): + wlock = repo.wlock() + try: f = repo.vfs(GitHandler.map_file, 'wb') map(f.write, new_map) + finally: + wlock.release() ui.status(_('git commit map cleaned\n')) def findcommonoutgoing(orig, repo, other, *args, **kwargs):
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -197,7 +197,8 @@ self._map_hg_real = map_hg_real def save_map(self, map_file): - with self.repo.wlock(): + wlock = self.repo.wlock() + try: file = self.repo.vfs(map_file, 'w+', atomictemp=True) map_hg = self._map_hg buf = cStringIO.StringIO() @@ -208,6 +209,8 @@ buf.close() # If this complains, atomictempfile no longer has close file.close() + finally: + wlock.release() def load_tags(self): self.tags = {}