[PATCH 2 of 9] revset: rename bisected() to bisect()

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sun Sep 18 18:31:13 CDT 2011


 mercurial/revset.py |  10 ++++++++--
 tests/test-bisect.t |  15 ++++++++++++---
 2 files changed, 20 insertions(+), 5 deletions(-)


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1316379251 -7200
# Node ID 1a45d6fdeffab94003a7815d0b5959fa92494f7c
# Parent  236b93854c812fda11bd19301c6416579a49164e
revset: rename bisected() to bisect()

Rename the 'bisected' keyword to simply 'bisect'.
Still accept the old name, but no longer advertise it.

As discussed with Matt on IRC.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -235,8 +235,8 @@
     n = getstring(x, _("author requires a string")).lower()
     return [r for r in subset if n in repo[r].user().lower()]
 
-def bisected(repo, subset, x):
-    """``bisected(string)``
+def bisect(repo, subset, x):
+    """``bisect(string)``
     Changesets marked in the specified bisect state (good, bad, skip).
     """
     state = getstring(x, _("bisect requires a string")).lower()
@@ -245,6 +245,11 @@
     marked = set(repo.changelog.rev(n) for n in hbisect.load_state(repo)[state])
     return [r for r in subset if r in marked]
 
+# Backward-compatibility
+# - no help entry so that we do not advertise it any more
+def bisected(repo, subset, x):
+    return bisect(repo, subset, x)
+
 def bookmark(repo, subset, x):
     """``bookmark([name])``
     The named bookmark or all bookmarks.
@@ -837,6 +842,7 @@
     "ancestor": ancestor,
     "ancestors": ancestors,
     "author": author,
+    "bisect": bisect,
     "bisected": bisected,
     "bookmark": bookmark,
     "branch": branch,
diff --git a/tests/test-bisect.t b/tests/test-bisect.t
--- a/tests/test-bisect.t
+++ b/tests/test-bisect.t
@@ -377,7 +377,7 @@
   date:        Thu Jan 01 00:00:06 1970 +0000
   summary:     msg 6
   
-  $ hg log -r "bisected(good)"
+  $ hg log -r "bisect(good)"
   changeset:   0:b99c7b9c8e11
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -388,13 +388,13 @@
   date:        Thu Jan 01 00:00:05 1970 +0000
   summary:     msg 5
   
-  $ hg log -r "bisected(bad)"
+  $ hg log -r "bisect(bad)"
   changeset:   6:a3d5c6fdf0d3
   user:        test
   date:        Thu Jan 01 00:00:06 1970 +0000
   summary:     msg 6
   
-  $ hg log -r "bisected(skip)"
+  $ hg log -r "bisect(skip)"
   changeset:   1:5cd978ea5149
   user:        test
   date:        Thu Jan 01 00:00:01 1970 +0000
@@ -416,6 +416,15 @@
   summary:     msg 4
   
 
+test legacy bisected() keyword
+
+  $ hg log -r "bisected(bad)"
+  changeset:   6:a3d5c6fdf0d3
+  user:        test
+  date:        Thu Jan 01 00:00:06 1970 +0000
+  summary:     msg 6
+  
+
   $ set +e
 
 test invalid command


More information about the Mercurial-devel mailing list