[PATCH 7 of 9 bm-refactor] commands: move activebookmarklabel to bookmarks module
Sean Farley
sean at farley.io
Tue Jun 20 20:29:30 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 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.
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)
More information about the Mercurial-devel
mailing list