[PATCH 1 of 4] bookmarks: name label for active bookmark correctly

Ryan McElroy rmcelroy at fb.com
Fri May 29 17:22:50 UTC 2015


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1429222739 25200
#      Thu Apr 16 15:18:59 2015 -0700
# Node ID a02a25350ccfb544f48a554ad60bee91263771f4
# Parent  a4acf019dd5b72e91a1b1321d80d298033be8111
bookmarks: name label for active bookmark correctly

Retain old label as well for backwards compatibility.

Today, the terms 'active' and 'current' are interchangeably used throughout the
codebase in reference to the active bookmark (the bookmark that will be updated
with the next commit). This leads to confusion among developers and users.
This patch is part of a series to standardize the usage to 'active' throughout
the mercurial codebase and user interface.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -84,7 +84,7 @@ effects may be overridden from your conf
   resolve.unresolved = red bold
   resolve.resolved = green bold
 
-  bookmarks.current = green
+  bookmarks.active = green
 
   branches.active = none
   branches.closed = black bold
@@ -313,7 +313,7 @@ except ImportError:
            'grep.filename': 'magenta',
            'grep.user': 'magenta',
            'grep.date': 'magenta',
-           'bookmarks.current': 'green',
+           'bookmarks.active': 'green',
            'branches.active': 'none',
            'branches.closed': 'black bold',
            'branches.current': 'green',
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -40,6 +40,9 @@ optionalrepo = ''
 # @command decorator.
 inferrepo = ''
 
+# label constants
+activebookmarklabel = 'bookmarks.active bookmarks.current' # for compatibility
+
 # common command options
 
 globalopts = [
@@ -1037,7 +1040,7 @@ def bookmark(ui, repo, *names, **opts):
         for bmark, n in sorted(marks.iteritems()):
             current = repo._activebookmark
             if bmark == current:
-                prefix, label = '*', 'bookmarks.current'
+                prefix, label = '*', activebookmarklabel
             else:
                 prefix, label = ' ', ''
 
@@ -5932,10 +5935,10 @@ def summary(ui, repo, **opts):
         ui.write(_('bookmarks:'), label='log.bookmark')
         if current is not None:
             if current in marks:
-                ui.write(' *' + current, label='bookmarks.current')
+                ui.write(' *' + current, label=activebookmarklabel)
                 marks.remove(current)
             else:
-                ui.write(' [%s]' % current, label='bookmarks.current')
+                ui.write(' [%s]' % current, label=activebookmarklabel)
         for m in marks:
             ui.write(' ' + m, label='log.bookmark')
         ui.write('\n', label='log.bookmark')


More information about the Mercurial-devel mailing list