[PATCH 1 of 3] bookmarks: rename current to active in variables and comments
Martin von Zweigbergk
martinvonz at google.com
Thu May 14 18:45:37 CDT 2015
Please ignore patch 1/2. This was just a result of my inept use of pushgate
with my series based on clowncopter instead of being based on Matt's repo.
On Thu, May 14, 2015 at 4:29 PM Ryan McElroy <rmcelroy at fb.com> wrote:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy at fb.com>
> # Date 1429041228 25200
> # Tue Apr 14 12:53:48 2015 -0700
> # Node ID f749a75992f4750cf9b4bc33226147944819f283
> # Parent d1bd0fd07ee6adf4ab3be2b0a0a7c0df54d55abf
> bookmarks: 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/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -22,7 +22,7 @@
> {hash}\s{name}\n (the same format as localtags) in
> .hg/bookmarks. The mapping is stored as {name: nodeid}.
>
> - This class does NOT handle the "current" bookmark state at this
> + This class does NOT handle the "active" bookmark state at this
> time.
> """
>
> @@ -137,8 +137,8 @@
> if mark not in repo._bookmarks:
> raise AssertionError('bookmark %s does not exist!' % mark)
>
> - current = repo._activebookmark
> - if current == mark:
> + active = repo._activebookmark
> + if active == mark:
> return
>
> wlock = repo.wlock()
> @@ -201,33 +201,33 @@
> check out and where to move the active bookmark from, if needed.'''
> movemarkfrom = None
> if checkout is None:
> - curmark = repo._activebookmark
> + activemark = repo._activebookmark
> if isactivewdirparent(repo):
> movemarkfrom = repo['.'].node()
> - elif curmark:
> - ui.status(_("updating to active bookmark %s\n") % curmark)
> - checkout = curmark
> + elif activemark:
> + ui.status(_("updating to active bookmark %s\n") % activemark)
> + checkout = activemark
> return (checkout, movemarkfrom)
>
> def update(repo, parents, node):
> deletefrom = parents
> marks = repo._bookmarks
> update = False
> - cur = repo._activebookmark
> - if not cur:
> + active = repo._activebookmark
> + if not active:
> return False
>
> - if marks[cur] in parents:
> + if marks[active] in parents:
> new = repo[node]
> divs = [repo[b] for b in marks
> - if b.split('@', 1)[0] == cur.split('@', 1)[0]]
> + if b.split('@', 1)[0] == active.split('@', 1)[0]]
> anc = repo.changelog.ancestors([new.rev()])
> deletefrom = [b.node() for b in divs if b.rev() in anc or b ==
> new]
> - if validdest(repo, repo[marks[cur]], new):
> - marks[cur] = new.node()
> + if validdest(repo, repo[marks[active]], new):
> + marks[active] = new.node()
> update = True
>
> - if deletedivergent(repo, deletefrom, cur):
> + if deletedivergent(repo, deletefrom, active):
> update = True
>
> if update:
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2489,13 +2489,13 @@
> # First, do a regular commit to record all changes in the
> working
> # directory (if there are any)
> ui.callhooks = False
> - currentbookmark = repo._activebookmark
> + activebookmark = repo._activebookmark
> try:
> repo._activebookmark = None
> opts['message'] = 'temporary amend commit for %s' % old
> node = commit(ui, repo, commitfunc, pats, opts)
> finally:
> - repo._activebookmark = currentbookmark
> + repo._activebookmark = activebookmark
> ui.callhooks = True
> ctx = repo[node]
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150514/47bc0b7a/attachment.html>
More information about the Mercurial-devel
mailing list