revset: add a bumped revset
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 19 Oct 2012 00:39:06 +0200
changeset 17829 c73f7a28953c
parent 17828 9495be4126ef
child 17830 1cb51d65453d
revset: add a bumped revset Select bumped changesets.
mercurial/revset.py
tests/test-obsolete.t
--- a/mercurial/revset.py	Fri Oct 19 00:36:18 2012 +0200
+++ b/mercurial/revset.py	Fri Oct 19 00:39:06 2012 +0200
@@ -422,6 +422,17 @@
     s = set(s)
     return [r for r in subset if r in s or repo[r].branch() in b]
 
+def bumped(repo, subset, x):
+    """``bumped()``
+    Mutable changesets marked as successors of public changesets.
+
+    Only non-public and non-obsolete changesets can be `bumped`.
+    """
+    # i18n: "bumped" is a keyword
+    getargs(x, 0, 0, _("bumped takes no arguments"))
+    bumped = obsmod.getrevs(repo, 'bumped')
+    return [r for r in subset if r in bumped]
+
 def checkstatus(repo, subset, pat, field):
     m = None
     s = []
@@ -1492,6 +1503,7 @@
     "bookmark": bookmark,
     "branch": branch,
     "branchpoint": branchpoint,
+    "bumped": bumped,
     "children": children,
     "closed": closed,
     "contains": contains,
--- a/tests/test-obsolete.t	Fri Oct 19 00:36:18 2012 +0200
+++ b/tests/test-obsolete.t	Fri Oct 19 00:39:06 2012 +0200
@@ -155,6 +155,22 @@
      summary:     add a
   
 
+And that bumped changeset are detected
+--------------------------------------
+
+If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
+note that the bumped changeset (5:5601fb93a350) is not a direct successor of
+the public changeset
+
+  $ hg log --hidden -r 'bumped()'
+  changeset:   5:5601fb93a350
+  tag:         tip
+  parent:      1:7c3bad9141dc
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add new_3_c
+  
+
   $ cd ..
 
 Exchange Test