# HG changeset patch # User Kevin Bullock # Date 1500926864 18000 # Node ID e7a8a5710257bbfc17fed7977d626bf75fed3611 # Parent 078c3912afce7513ddc82321aa6f49fde8d42434 wlock: use non-context-manager form to restore older hg support diff --git a/hggit/__init__.py b/hggit/__init__.py --- 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): diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- 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 = {}