mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
bookmarks: stop wrapping bookmarks.write
Summary: Upstream mercurial has deleted bookmarks.write() since all bookmark writes happen via transactions now. So we can delete our write wrapper for that. We already wrap transaction closes, so nothing new needs to be added. Test Plan: Ran the tests Reviewers: #mercurial, ttung, rmcelroy Reviewed By: rmcelroy Differential Revision: https://phabricator.intern.facebook.com/D3289117 Signature: t1:3289117:1463000038:aaf3454059514d92a017bd579b6de0691b334795
This commit is contained in:
parent
c58a61d5cd
commit
95858fbd8a
27
hgsql.py
27
hgsql.py
@ -121,8 +121,6 @@ def uisetup(ui):
|
||||
# Reorder incoming revs to be in linkrev order
|
||||
wrapfunction(revlog.revlog, 'addgroup', addgroup)
|
||||
|
||||
# Write SQL bookmarks at the same time as local bookmarks
|
||||
wrapfunction(bookmarks.bmstore, 'write', bookmarkwrite)
|
||||
|
||||
def extsetup(ui):
|
||||
if ui.configbool('hgsql', 'enabled'):
|
||||
@ -1390,31 +1388,6 @@ def bookmarkcommand(orig, ui, repo, *names, **opts):
|
||||
else:
|
||||
return _bookmarkcommand()
|
||||
|
||||
def bookmarkwrite(orig, self):
|
||||
repo = self._repo
|
||||
if not issqlrepo(repo) or repo.disablesync:
|
||||
return orig(self)
|
||||
|
||||
if not repo.sqlconn:
|
||||
raise util.Abort("attempted bookmark write without sql connection")
|
||||
elif not repo.hassqllock(writelock):
|
||||
raise util.Abort("attempted bookmark write without write lock")
|
||||
|
||||
try:
|
||||
cursor = repo.sqlcursor
|
||||
cursor.execute("""DELETE FROM revision_references WHERE repo = %s AND
|
||||
namespace = 'bookmarks'""", (repo.sqlreponame,))
|
||||
|
||||
for k, v in self.iteritems():
|
||||
cursor.execute("""INSERT INTO revision_references(repo, namespace, name, value)
|
||||
VALUES(%s, 'bookmarks', %s, %s)""",
|
||||
(repo.sqlreponame, k, hex(v)))
|
||||
repo.sqlconn.commit()
|
||||
return orig(self)
|
||||
except:
|
||||
repo.sqlconn.rollback()
|
||||
raise
|
||||
|
||||
def pushkey(orig, repo, proto, namespace, key, old, new):
|
||||
if issqlrepo(repo):
|
||||
def commitpushkey():
|
||||
|
Loading…
Reference in New Issue
Block a user