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

login
register
mail settings
Submitter Sean Farley
Date June 21, 2017, 12:29 a.m.
Message ID <c81183c6280a88dd0258.1498004970@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21561/
State Accepted
Headers show

Comments

Sean Farley - June 21, 2017, 12:29 a.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 c81183c6280a88dd02587b0c8106aa8632236003
# Parent  08100d41c80e0770dba233fee6a316a0cc99bfda
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 76f01e1..cc91ebc 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 fa5e37c..c3a3a64 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'),
@@ -991,11 +985,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:
@@ -4813,14 +4807,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)