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

Ryan McElroy rmcelroy at fb.com
Mon May 4 19:44:50 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 333c7c3487c28d91df26c4751c2167a9ca68a2d2
# Parent  ccbbed6c718894b21aa79e397111b1e8540b0cf3
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/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