[PATCH 5 of 9 V2] revset: add a bumped revset

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Oct 15 07:46:19 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1350300187 -7200
# Node ID 06d6919ff5792a6afdc759ff337dd7d6fdd7ad4c
# Parent  b992c8e9e2a74630a9f932e98f46a34a6252725b
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
@@ -420,10 +420,21 @@ def branch(repo, subset, x):
     for r in s:
         b.add(repo[r].branch())
     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 changeset trying to succeed to a public changeset.
+
+    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.getobscache(repo, 'bumped')
+    return [r for r in subset if r in bumped]
+
 def checkstatus(repo, subset, pat, field):
     m = None
     s = []
     hasset = matchmod.patkind(pat) == 'set'
     fname = None
@@ -1492,10 +1503,11 @@ symbols = {
     "bisect": bisect,
     "bisected": bisected,
     "bookmark": bookmark,
     "branch": branch,
     "branchpoint": branchpoint,
+    "bumped": bumped,
     "children": children,
     "closed": closed,
     "contains": contains,
     "converted": converted,
     "date": date,
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -153,10 +153,26 @@ Check that public changeset are not acco
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     add a
   
 
+And that bumped changeset are detected
+--------------------------------------
+
+If we did filtered obsolete changeset out, 3 and 4 would show up too. Also
+notes that the bumped changeset (5:5601fb93a350) is not a direct successors of
+the public changset
+
+  $ 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