[PATCH 05 of 10 V4] revset: add a bumped revset

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Oct 18 17:52:28 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1350599946 -7200
# Node ID 5dccdbe9f0a7bcfe28e394b39ca2e4ecb9eba6cd
# Parent  9ddc31d21621f5661db72dd4bf70557c74d196a5
revset: add a bumped revset

Select bumped changesets.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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 trying to succeed to a 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,
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -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


More information about the Mercurial-devel mailing list