##// END OF EJS Templates
push: update bookmarks (on server) within a transaction...
Pierre-Yves David -
r22667:3acc3f95 default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from mercurial.i18n import _
8 from mercurial.i18n import _
9 from mercurial.node import hex, bin
9 from mercurial.node import hex, bin
10 from mercurial import encoding, error, util, obsolete
10 from mercurial import encoding, error, util, obsolete, lock as lockmod
11 import errno
11 import errno
12
12
13 class bmstore(dict):
13 class bmstore(dict):
@@ -235,8 +235,11 b' def listbookmarks(repo):'
235 return d
235 return d
236
236
237 def pushbookmark(repo, key, old, new):
237 def pushbookmark(repo, key, old, new):
238 w = repo.wlock()
238 w = l = tr = None
239 try:
239 try:
240 w = repo.wlock()
241 l = repo.lock()
242 tr = repo.transaction('bookmarks')
240 marks = repo._bookmarks
243 marks = repo._bookmarks
241 existing = hex(marks.get(key, ''))
244 existing = hex(marks.get(key, ''))
242 if existing != old and existing != new:
245 if existing != old and existing != new:
@@ -247,10 +250,11 b' def pushbookmark(repo, key, old, new):'
247 if new not in repo:
250 if new not in repo:
248 return False
251 return False
249 marks[key] = repo[new].node()
252 marks[key] = repo[new].node()
250 marks.write()
253 marks.recordchange(tr)
254 tr.close()
251 return True
255 return True
252 finally:
256 finally:
253 w.release()
257 lockmod.release(tr, l, w)
254
258
255 def compare(repo, srcmarks, dstmarks,
259 def compare(repo, srcmarks, dstmarks,
256 srchex=None, dsthex=None, targets=None):
260 srchex=None, dsthex=None, targets=None):
General Comments 0
You need to be logged in to leave comments. Login now