Skip to content

Commit

Permalink
Avoid deprecated bookmarks.write()
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Contreras <[email protected]>
  • Loading branch information
felipec committed May 18, 2016
1 parent b6e9475 commit 822c6e4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,23 @@ def updatebookmarks(repo, peer):
for k, v in remotemarks.iteritems():
localmarks[k] = hgbin(v)

if hasattr(localmarks, 'write'):
localmarks.write()
if check_version(3, 6):
lock = tr = None
try:
lock = repo.lock()
tr = repo.transaction('bookmark')
localmarks.recordchange(tr)
tr.close()
finally:
if tr is not None:
tr.release()
if lock is not None:
lock.release()
else:
bookmarks.write(repo)
if hasattr(localmarks, 'write'):
localmarks.write()
else:
bookmarks.write(repo)

def get_repo(url, alias):
global peer
Expand Down

0 comments on commit 822c6e4

Please sign in to comment.