# HG changeset patch # User Ryan McElroy # Date 1428989221 25200 # Node ID e0b0fbd47491e0ec8039f7d530b05280195bbe4b # Parent 08ec11e3ae4cd12a2a2a32bc628cbeae6f046383 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. diff -r 08ec11e3ae4c -r e0b0fbd47491 hgext/rebase.py --- 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')) diff -r 08ec11e3ae4c -r e0b0fbd47491 mercurial/bookmarks.py --- 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 ). +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) diff -r 08ec11e3ae4c -r e0b0fbd47491 mercurial/commands.py --- 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: diff -r 08ec11e3ae4c -r e0b0fbd47491 mercurial/hg.py --- 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: