mercurial/revset.py
changeset 13750 7eb82f88e157
parent 13670 15b97a1cd60b
child 13873 02c3d4d44a92
--- a/mercurial/revset.py	Wed Mar 23 22:58:40 2011 +0100
+++ b/mercurial/revset.py	Wed Mar 23 19:28:16 2011 -0500
@@ -298,9 +298,18 @@
     return [r for r in subset if r in cs]
 
 def branch(repo, subset, x):
-    """``branch(set)``
-    All changesets belonging to the branches of changesets in set.
+    """``branch(string or set)``
+    All changesets belonging to the given branch or the branches of the given
+    changesets.
     """
+    try:
+        b = getstring(x, '')
+        if b in repo.branchmap():
+            return [r for r in subset if repo[r].branch() == b]
+    except error.ParseError:
+        # not a string, but another revspec, e.g. tip()
+        pass
+
     s = getset(repo, range(len(repo)), x)
     b = set()
     for r in s: