[PATCH v2] bookmarks: allow renaming active bookmark using '.'

David Demelier markand at malikania.fr
Thu Aug 24 07:07:53 UTC 2017


# HG changeset patch
# User David Demelier <markand at malikania.fr>
# Date 1503298366 -7200
#      Mon Aug 21 08:52:46 2017 +0200
# Node ID 546e72c2f4134145b4a91d6e03c1b0ff70b2bd9a
# Parent  4e8a46c25facaebca476634d52dd78431d3143e8
bookmarks: allow renaming active bookmark using '.'

diff -r 4e8a46c25fac -r 546e72c2f413 mercurial/commands.py
--- a/mercurial/commands.py	Tue Aug 22 11:00:00 2017 +0200
+++ b/mercurial/commands.py	Mon Aug 21 08:52:46 2017 +0200
@@ -968,6 +968,7 @@
                     raise error.Abort(_("new bookmark name required"))
                 elif len(names) > 1:
                     raise error.Abort(_("only one new bookmark name allowed"))
+                rename = repo._bookmarks.expandname(rename)
                 bookmarks.rename(repo, tr, rename, names[0], force, inactive)
             elif names:
                 bookmarks.addbookmarks(repo, tr, names, rev, force, inactive)
diff -r 4e8a46c25fac -r 546e72c2f413 tests/test-bookmarks.t
--- a/tests/test-bookmarks.t	Tue Aug 22 11:00:00 2017 +0200
+++ b/tests/test-bookmarks.t	Mon Aug 21 08:52:46 2017 +0200
@@ -191,6 +191,28 @@
 
   $ hg bookmark -f -m X Y
 
+rename bookmark using .
+
+  $ hg book rename-me
+  $ hg book -m . renamed
+  $ hg bookmark
+     X2                        1:925d80f479bb
+     Y                         2:db815d6d32e6
+     Z                         0:f7b1eb17ad24
+   * renamed                   2:db815d6d32e6
+  $ hg up -q Y
+  $ hg book -d renamed
+
+rename bookmark using . with no active bookmark
+
+  $ hg book rename-me
+  $ hg book -i rename-me
+  $ hg book -m . renamed
+  abort: no active bookmark
+  [255]
+  $ hg up -q Y
+  $ hg book -d rename-me
+
 list bookmarks
 
   $ hg bookmark


More information about the Mercurial-devel mailing list