Patchwork [6,of,9,bm-refactor] commands: remove locking code since the bookmarks module does that

login
register
mail settings
Submitter Sean Farley
Date June 21, 2017, 12:29 a.m.
Message ID <08100d41c80e0770dba2.1498004969@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21559/
State Accepted
Headers show

Comments

Sean Farley - June 21, 2017, 12:29 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1497998203 25200
#      Tue Jun 20 15:36:43 2017 -0700
# Branch bm-refactor
# Node ID 08100d41c80e0770dba233fee6a316a0cc99bfda
# Parent  33c058ef48902109bce8c199ba17b5afea58b8a0
commands: remove locking code since the bookmarks module does that

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
index e87c74e..fa5e37c 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -965,38 +965,27 @@  def bookmark(ui, repo, *names, **opts):
         raise error.Abort(_("--rev is incompatible with --rename"))
     if not names and (delete or rev):
         raise error.Abort(_("bookmark name required"))
 
     if delete or rename or names or inactive:
-        wlock = lock = tr = None
-        try:
-            wlock = repo.wlock()
-            lock = repo.lock()
-            cur = repo.changectx('.').node()
-            marks = repo._bookmarks
-            if delete:
-                bookmarks.delete(repo, names)
-            elif rename:
-                if not names:
-                    raise error.Abort(_("new bookmark name required"))
-                elif len(names) > 1:
-                    raise error.Abort(_("only one new bookmark name allowed"))
-                bookmarks.rename(repo, rename, names[0], force, inactive)
-            elif names:
-                bookmarks.addbookmarks(repo, names, rev, force, inactive)
-            elif inactive:
-                if len(marks) == 0:
-                    ui.status(_("no bookmarks set\n"))
-                elif not repo._activebookmark:
-                    ui.status(_("no active bookmark\n"))
-                else:
-                    bookmarks.deactivate(repo)
-            if tr is not None:
-                marks.recordchange(tr)
-                tr.close()
-        finally:
-            lockmod.release(tr, lock, wlock)
+        if delete:
+            bookmarks.delete(repo, names)
+        elif rename:
+            if not names:
+                raise error.Abort(_("new bookmark name required"))
+            elif len(names) > 1:
+                raise error.Abort(_("only one new bookmark name allowed"))
+            bookmarks.rename(repo, rename, names[0], force, inactive)
+        elif names:
+            bookmarks.addbookmarks(repo, names, rev, force, inactive)
+        elif inactive:
+            if len(repo._bookmarks) == 0:
+                ui.status(_("no bookmarks set\n"))
+            elif not repo._activebookmark:
+                ui.status(_("no active bookmark\n"))
+            else:
+                bookmarks.deactivate(repo)
     else: # show bookmarks
         fm = ui.formatter('bookmarks', opts)
         hexfn = fm.hexfunc
         marks = repo._bookmarks
         if len(marks) == 0 and fm.isplain():