comparison hggit/__init__.py @ 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 78959c8e5e60
children 620a1095f3a9
comparison
equal deleted inserted replaced
1025:078c3912afce 1026:e7a8a5710257
268 new_map = [] 268 new_map = []
269 for line in repo.vfs(GitHandler.map_file): 269 for line in repo.vfs(GitHandler.map_file):
270 gitsha, hgsha = line.strip().split(' ', 1) 270 gitsha, hgsha = line.strip().split(' ', 1)
271 if hgsha in repo: 271 if hgsha in repo:
272 new_map.append('%s %s\n' % (gitsha, hgsha)) 272 new_map.append('%s %s\n' % (gitsha, hgsha))
273 with repo.wlock(): 273 wlock = repo.wlock()
274 try:
274 f = repo.vfs(GitHandler.map_file, 'wb') 275 f = repo.vfs(GitHandler.map_file, 'wb')
275 map(f.write, new_map) 276 map(f.write, new_map)
277 finally:
278 wlock.release()
276 ui.status(_('git commit map cleaned\n')) 279 ui.status(_('git commit map cleaned\n'))
277 280
278 def findcommonoutgoing(orig, repo, other, *args, **kwargs): 281 def findcommonoutgoing(orig, repo, other, *args, **kwargs):
279 if isinstance(other, gitrepo.gitrepo): 282 if isinstance(other, gitrepo.gitrepo):
280 heads = repo.githandler.get_refs(other.path)[0] 283 heads = repo.githandler.get_refs(other.path)[0]