Submitter | Ryan McElroy |
---|---|
Date | May 29, 2015, 5:22 p.m. |
Message ID | <4dc7e32d957bcddb9dfe.1432920172@devbig105.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/9374/ |
State | Accepted |
Headers | show |
Comments
On Fri, May 29, 2015 at 10:22:52AM -0700, Ryan McElroy wrote: > # HG changeset patch > # User Ryan McElroy <rmcelroy@fb.com> > # Date 1432868779 25200 > # Thu May 28 20:06:19 2015 -0700 > # Node ID 4dc7e32d957bcddb9dfe86c6d9443ba1c09fe1ac > # Parent d3f11c27efe7c16820bef650f7cef6cd0dfd72ef > commands: rename current to active in variables and comments Patches 1-3 queued. I've got some confusion (probably on my end) in patch 4 that I'll ask about there. I made one comment tweak to patch one to make some things more self-documenting without using `blame` - hopefully you don't mind. > > 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 > @@ -1038,8 +1038,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 = ' ', '' > @@ -1051,7 +1051,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() > > @@ -1520,7 +1520,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(): > @@ -1532,7 +1532,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: > @@ -5930,15 +5930,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') > @@ -6358,7 +6358,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 > @@ -6411,7 +6411,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 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1038,8 +1038,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 = ' ', '' @@ -1051,7 +1051,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() @@ -1520,7 +1520,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(): @@ -1532,7 +1532,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: @@ -5930,15 +5930,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') @@ -6358,7 +6358,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 @@ -6411,7 +6411,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