changeset 25347:ceec79b5657a

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.
author Ryan McElroy <rmcelroy@fb.com>
date Thu, 16 Apr 2015 15:18:59 -0700
parents fe0aac1082f3
children f26efa4f0eff
files hgext/color.py mercurial/commands.py
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Sat May 30 02:06:09 2015 +0800
+++ b/hgext/color.py	Thu Apr 16 15:18:59 2015 -0700
@@ -84,7 +84,7 @@
   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 @@
            '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',
--- a/mercurial/commands.py	Sat May 30 02:06:09 2015 +0800
+++ b/mercurial/commands.py	Thu Apr 16 15:18:59 2015 -0700
@@ -40,6 +40,12 @@
 # @command decorator.
 inferrepo = ''
 
+# label constants
+# until 3.5, bookmarks.current was the advertised name, not
+# bookmarks.active, so we must use both to avoid breaking old
+# custom styles
+activebookmarklabel = 'bookmarks.active bookmarks.current'
+
 # common command options
 
 globalopts = [
@@ -1037,7 +1043,7 @@
         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 +5938,10 @@
         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')