[PATCH 3 of 4 V2] bookmarks: rename readcurrent to readactive

Ryan McElroy rmcelroy at fb.com
Tue May 5 12:36:25 CDT 2015


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1428991393 25200
#      Mon Apr 13 23:03:13 2015 -0700
# Node ID 3fae1a985ae9ef452aedb0e6c93ad02297248b4c
# Parent  736ffdcc73cb164b24ac97e58209f6f9995fd676
bookmarks: rename readcurrent to readactive

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/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -888,7 +888,7 @@ def abort(repo, originalwd, target, stat
             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 --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -107,12 +107,17 @@ class bmstore(dict):
             fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name)))
 
 def readcurrent(repo):
-    '''Get the current bookmark
+    warnings.warn('deprecated function bookmarks.readcurrent() called. ' +
+                  'update extension to call bookmarks.readactive() instead.',
+                  category=DeprecationWarning, stacklevel=2)
+    return readactive(repo)
 
-    If we use gittish branches we have a current bookmark that
-    we are on. This function returns the name of the bookmark. It
-    is stored in .hg/bookmarks.current
-    '''
+def readactive(repo):
+    """
+    Get the active bookmark. We can have an active bookmark that updates
+    itself as we commit. This function returns the name of that bookmark.
+    It is stored in .hg/bookmarks.current
+    """
     mark = None
     try:
         file = repo.vfs('bookmarks.current')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -419,7 +419,7 @@ class localrepository(object):
 
     @repofilecache('bookmarks.current')
     def _bookmarkcurrent(self):
-        return bookmarks.readcurrent(self)
+        return bookmarks.readactive(self)
 
     def bookmarkheads(self, bookmark):
         name = bookmark.split('@', 1)[0]


More information about the Mercurial-devel mailing list