[PATCH 5 of 7 bm-refactor V2] commands: move activebookmarklabel to bookmarks module

Sean Farley sean at farley.io
Wed Jun 21 16:45:12 EDT 2017


# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1497999389 25200
#      Tue Jun 20 15:56:29 2017 -0700
# Branch bm-refactor
# Node ID b0332f98ac1229f5c8fd0ab2f4e52392f192aa82
# Parent  c77f6d15508faf1d95753c7e1f52b7b5d3d63cf4
commands: move activebookmarklabel to bookmarks module

This is going to be used in an upcoming patch that moves more methods to
bookmarks.py.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
index d1bac53..99c23e2 100644
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -23,10 +23,16 @@ from . import (
     scmutil,
     txnutil,
     util,
 )
 
+# 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'
+
 def _getbkfile(repo):
     """Hook so that extensions that mess with the store can hook bm storage.
 
     For core, this just handles wether we should see pending
     bookmarks or the committed ones. Other extensions (like share)
diff --git a/mercurial/commands.py b/mercurial/commands.py
index 085dcfb..3778095 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -64,16 +64,10 @@ release = lockmod.release
 table = {}
 table.update(debugcommandsmod.command._table)
 
 command = registrar.command(table)
 
-# 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 = [
     ('R', 'repository', '',
      _('repository root directory or name of overlay bundle file'),
@@ -992,11 +986,11 @@ def bookmark(ui, repo, *names, **opts):
         if len(marks) == 0 and fm.isplain():
             ui.status(_("no bookmarks set\n"))
         for bmark, n in sorted(marks.iteritems()):
             active = repo._activebookmark
             if bmark == active:
-                prefix, label = '*', activebookmarklabel
+                prefix, label = '*', bookmarks.activebookmarklabel
             else:
                 prefix, label = ' ', ''
 
             fm.startitem()
             if not ui.quiet:
@@ -4814,14 +4808,14 @@ def summary(ui, repo, **opts):
         active = repo._activebookmark
         # i18n: column positioning for "hg summary"
         ui.write(_('bookmarks:'), label='log.bookmark')
         if active is not None:
             if active in marks:
-                ui.write(' *' + active, label=activebookmarklabel)
+                ui.write(' *' + active, label=bookmarks.activebookmarklabel)
                 marks.remove(active)
             else:
-                ui.write(' [%s]' % active, label=activebookmarklabel)
+                ui.write(' [%s]' % active, label=bookmarks.activebookmarklabel)
         for m in marks:
             ui.write(' ' + m, label='log.bookmark')
         ui.write('\n', label='log.bookmark')
 
     status = repo.status(unknown=True)


More information about the Mercurial-devel mailing list