Skip to content
Snippets Groups Projects
Commit 0b957c2d authored by Sean Farley's avatar Sean Farley
Browse files

util: add method for writing bookmarks

parent a3da4592
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
from dulwich import errors
from mercurial import (
lock as lockmod,
util as hgutil,
)
......@@ -92,3 +93,19 @@
if re.match(fqdn_re, giturl):
return True
return False
def recordbookmarks(repo, bms, name='git_handler'):
"""abstract writing bookmarks for backwards compatibility"""
tr = lock = wlock = None
try:
wlock = repo.wlock()
lock = repo.lock()
tr = repo.transaction(name)
if hgutil.safehasattr(bms, 'recordchange'):
# recordchange was added in mercurial 3.2
bms.recordchange(tr)
else:
bms.write()
tr.close()
finally:
lockmod.release(tr, lock, wlock)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment