# HG changeset patch # User Ryan McElroy # Date 2015-05-29 03:06:19 # Node ID 62da2d7745f9dc41422f7f81a75009c130a873cd # Parent f26efa4f0eff9db91a762e8af875fdfd4d75c9a5 commands: rename current to active in variables and comments 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1041,8 +1041,8 @@ def bookmark(ui, repo, *names, **opts): if len(marks) == 0 and not fm: ui.status(_("no bookmarks set\n")) for bmark, n in sorted(marks.iteritems()): - current = repo._activebookmark - if bmark == current: + active = repo._activebookmark + if bmark == active: prefix, label = '*', activebookmarklabel else: prefix, label = ' ', '' @@ -1054,7 +1054,7 @@ def bookmark(ui, repo, *names, **opts): pad = " " * (25 - encoding.colwidth(bmark)) fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', repo.changelog.rev(n), hexfn(n), label=label) - fm.data(active=(bmark == current)) + fm.data(active=(bmark == active)) fm.plain('\n') fm.end() @@ -1523,7 +1523,7 @@ def commit(ui, repo, *pats, **opts): match, extra=extra) - current = repo._activebookmark + active = repo._activebookmark marks = old.bookmarks() node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) if node == old.node(): @@ -1535,7 +1535,7 @@ def commit(ui, repo, *pats, **opts): newmarks = repo._bookmarks for bm in marks: newmarks[bm] = node - if bm == current: + if bm == active: bookmarks.activate(repo, bm) newmarks.write() else: @@ -5933,15 +5933,15 @@ def summary(ui, repo, **opts): ui.status(m, label='log.branch') if marks: - current = repo._activebookmark + active = repo._activebookmark # i18n: column positioning for "hg summary" ui.write(_('bookmarks:'), label='log.bookmark') - if current is not None: - if current in marks: - ui.write(' *' + current, label=activebookmarklabel) - marks.remove(current) + if active is not None: + if active in marks: + ui.write(' *' + active, label=activebookmarklabel) + marks.remove(active) else: - ui.write(' [%s]' % current, label=activebookmarklabel) + ui.write(' [%s]' % active, label=activebookmarklabel) for m in marks: ui.write(' ' + m, label='log.bookmark') ui.write('\n', label='log.bookmark') @@ -6361,7 +6361,7 @@ def update(ui, repo, node=None, rev=None Update the repository's working directory to the specified changeset. If no changeset is specified, update to the tip of the - current named branch and move the current bookmark (see :hg:`help + current named branch and move the active bookmark (see :hg:`help bookmarks`). Update sets the working directory's parent revision to the specified @@ -6414,7 +6414,7 @@ def update(ui, repo, node=None, rev=None cmdutil.clearunfinished(repo) - # with no argument, we also move the current bookmark, if any + # with no argument, we also move the active bookmark, if any rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) # if we defined a bookmark, we have to remember the original bookmark name diff --git a/tests/test-bookmarks-current.t b/tests/test-bookmarks-current.t --- a/tests/test-bookmarks-current.t +++ b/tests/test-bookmarks-current.t @@ -69,7 +69,7 @@ list bookmarks * Y 0:719295282060 Z -1:000000000000 -Verify that switching to Z updates the current bookmark: +Verify that switching to Z updates the active bookmark: $ hg update Z 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (activating bookmark Z) @@ -118,7 +118,7 @@ set bookmark Z using -i * Y 0:719295282060 Z 0:719295282060 -deactivate current bookmark using -i +deactivate active bookmark using -i $ hg bookmark -i Y $ hg bookmarks @@ -137,7 +137,7 @@ deactivate current bookmark using -i * Y 0:719295282060 Z 0:719295282060 -deactivate current bookmark while renaming +deactivate active bookmark while renaming $ hg bookmark -i -m Y X $ hg bookmarks diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -530,7 +530,7 @@ create bundle with two heads added 2 changesets with 2 changes to 2 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) -update to current bookmark if it's not the parent +update to active bookmark if it's not the parent $ hg summary parent: 2:db815d6d32e6 diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -3082,7 +3082,7 @@ Test revset function Rev: 0 Ancestor: 0 -Test current bookmark templating +Test active bookmark templating $ hg book foo $ hg book bar