Mercurial > hg
changeset 24945:e0b0fbd47491
bookmarks: rename setcurrent to activate (API)
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.
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Mon, 13 Apr 2015 22:27:01 -0700 |
parents | 08ec11e3ae4c |
children | c44534209a0a |
files | hgext/rebase.py mercurial/bookmarks.py mercurial/commands.py mercurial/hg.py |
diffstat | 4 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Mon Apr 13 21:53:37 2015 -0700 +++ b/hgext/rebase.py Mon Apr 13 22:27:01 2015 -0700 @@ -498,7 +498,7 @@ if (activebookmark and repo['.'].node() == repo._bookmarks[activebookmark]): - bookmarks.setcurrent(repo, activebookmark) + bookmarks.activate(repo, activebookmark) finally: release(lock, wlock) @@ -888,7 +888,7 @@ repair.strip(repo.ui, repo, strippoints) if activebookmark: - bookmarks.setcurrent(repo, activebookmark) + bookmarks.activate(repo, activebookmark) clearstatus(repo) repo.ui.warn(_('rebase aborted\n'))
--- a/mercurial/bookmarks.py Mon Apr 13 21:53:37 2015 -0700 +++ b/mercurial/bookmarks.py Mon Apr 13 22:27:01 2015 -0700 @@ -129,12 +129,12 @@ file.close() return mark -def setcurrent(repo, mark): - '''Set the name of the bookmark that we are currently on - - Set the name of the bookmark that we are on (hg update <bookmark>). +def activate(repo, mark): + """ + Set the given bookmark to be 'active', meaning that this bookmark will + follow new commits that are made. The name is recorded in .hg/bookmarks.current - ''' + """ if mark not in repo._bookmarks: raise AssertionError('bookmark %s does not exist!' % mark)
--- a/mercurial/commands.py Mon Apr 13 21:53:37 2015 -0700 +++ b/mercurial/commands.py Mon Apr 13 22:27:01 2015 -0700 @@ -995,7 +995,7 @@ checkconflict(repo, mark, cur, force) marks[mark] = marks[rename] if repo._bookmarkcurrent == rename and not inactive: - bookmarks.setcurrent(repo, mark) + bookmarks.activate(repo, mark) del marks[rename] marks.write() @@ -1014,7 +1014,7 @@ checkconflict(repo, mark, cur, force, tgt) marks[mark] = tgt if not inactive and cur == marks[newact] and not rev: - bookmarks.setcurrent(repo, newact) + bookmarks.activate(repo, newact) elif cur != tgt and newact == repo._bookmarkcurrent: bookmarks.deactivate(repo) marks.write() @@ -1519,7 +1519,7 @@ for bm in marks: newmarks[bm] = node if bm == current: - bookmarks.setcurrent(repo, bm) + bookmarks.activate(repo, bm) newmarks.write() else: def commitfunc(ui, repo, message, match, opts): @@ -6407,7 +6407,7 @@ if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) elif brev in repo._bookmarks: - bookmarks.setcurrent(repo, brev) + bookmarks.activate(repo, brev) ui.status(_("(activating bookmark %s)\n") % brev) elif brev: if repo._bookmarkcurrent:
--- a/mercurial/hg.py Mon Apr 13 21:53:37 2015 -0700 +++ b/mercurial/hg.py Mon Apr 13 22:27:01 2015 -0700 @@ -497,7 +497,7 @@ destrepo.ui.status(status) _update(destrepo, uprev) if update in destrepo._bookmarks: - bookmarks.setcurrent(destrepo, update) + bookmarks.activate(destrepo, update) finally: release(srclock, destlock) if cleandir is not None: