Patchwork [5,of,7,bm-refactor,V3] commands: move activebookmarklabel to bookmarks module

login
register
mail settings
Submitter Sean Farley
Date June 23, 2017, 6:33 p.m.
Message ID <e038a46ceca85f7de460.1498242801@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21636/
State Accepted
Headers show

Comments

Sean Farley - June 23, 2017, 6:33 p.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1497999389 25200
#      Tue Jun 20 15:56:29 2017 -0700
# Branch bm-refactor
# Node ID e038a46ceca85f7de4605506fda3959d43541826
# Parent  5431515879d0efdf36825c094d66b9345f635e95
commands: move activebookmarklabel to bookmarks module

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

Patch

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)