[PATCH 5 of 5] bookmark: limit transaction scope to bookmarks only

Jun Wu quark at fb.com
Mon Feb 27 12:35:29 EST 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1488214902 28800
#      Mon Feb 27 09:01:42 2017 -0800
# Node ID 234f60fffa4991fa5cf80bd5fafdc78bbb99607d
# Parent  f88c37484782ae7fede3c7a2a27a5f5d9b12bc9a
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 234f60fffa49
bookmark: limit transaction scope to bookmarks only

This will avoid unnecessary backups of dirstate, phaseroots, etc. So
the bookmark command is faster.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1057,5 +1057,5 @@ def bookmark(ui, repo, *names, **opts):
             marks = repo._bookmarks
             if delete:
-                tr = repo.transaction('bookmark')
+                tr = repo.transaction('bookmark', scope=['bookmarks'])
                 for mark in names:
                     if mark not in marks:
@@ -1067,5 +1067,5 @@ def bookmark(ui, repo, *names, **opts):
 
             elif rename:
-                tr = repo.transaction('bookmark')
+                tr = repo.transaction('bookmark', scope=['bookmarks'])
                 if not names:
                     raise error.Abort(_("new bookmark name required"))
@@ -1082,5 +1082,5 @@ def bookmark(ui, repo, *names, **opts):
                 del marks[rename]
             elif names:
-                tr = repo.transaction('bookmark')
+                tr = repo.transaction('bookmark', scope=['bookmarks'])
                 newact = None
                 for mark in names:


More information about the Mercurial-devel mailing list