Commits

Pierre-Yves David committed 0b444d7

update revset vocabulary to use precursors, successors

Comments (0)

Files changed (2)

hgext/obsolete.py

     return [r for r in subset if r in repo._extinctset]
 
 
-def _obsparents(repo, s):
-    """obsolete parents of a subset"""
+def _precursors(repo, s):
+    """Precursor of a changeset"""
     cs = set()
     nm = repo.changelog.nodemap
     markerbysubj = repo.obsoletestore.subjects
                 cs.add(pr)
     return cs
 
-def revsetobsparents(repo, subset, x):
-    """obsolete parents"""
+def revsetprecursors(repo, subset, x):
+    """precursors of a subset"""
     s = revset.getset(repo, range(len(repo)), x)
-    cs = _obsparents(repo, s)
+    cs = _precursors(repo, s)
     return [r for r in subset if r in cs]
 
-def _obsancestors(repo, s):
-    """obsolete ancestors of a subset"""
+def _allprecursors(repo, s):  # XXX we need a better naming
+    """transitive precursors of a subset"""
     toproceed = [repo[r].node() for r in s]
     seen = set()
     allsubjects = repo.obsoletestore.subjects
             cs.add(pr)
     return cs
 
-def revsetobsancestors(repo, subset, x):
+def revsetallprecursors(repo, subset, x):
     """obsolete parents"""
     s = revset.getset(repo, range(len(repo)), x)
-    cs = _obsancestors(repo, s)
+    cs = _allprecursors(repo, s)
     return [r for r in subset if r in cs]
 
 
     revset.symbols["unstable"] = revsetunstable
     revset.symbols["suspended"] = revsetsuspended
     revset.symbols["extinct"] = revsetextinct
-    revset.symbols["obsparents"] = revsetobsparents
-    revset.symbols["obsancestors"] = revsetobsancestors
+    revset.symbols["obsparents"] = revsetprecursors  # DEPR
+    revset.symbols["precursors"] = revsetprecursors
+    revset.symbols["obsancestors"] = revsetallprecursors  # DEPR
+    revset.symbols["allprecursors"] = revsetallprecursors  # bad name
 
     templatekw.keywords['obsolete'] = obsoletekw
 
             extensions.wrapfunction(rebase, 'concludenode', concludenode)
             extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase)
     except KeyError:
-        pass # rebase not found
+        pass  # rebase not found
 
 # Pushkey mechanism for mutable
 #########################################

tests/test-obsolete.t

   > [phases]
   > publish=False
   > [alias]
-  > odiff=diff --rev 'limit(obsparents(.),1)' --rev .
+  > odiff=diff --rev 'limit(precursors(.),1)' --rev .
   > [extensions]
   > hgext.graphlog=
   > EOF
 
 Test that obsolete parent a properly computed
 
-  $ qlog -r 'obsparents(.)' --hidden
+  $ qlog -r 'precursors(.)' --hidden
   2
   - 4538525df7e2
   $ qlog -r .
   - 4538525df7e2
   3
   - 0d3f46688ccc
-  $ qlog -r 'obsancestors(4)' --hidden
+  $ qlog -r 'allprecursors(4)' --hidden
   2
   - 4538525df7e2
   3
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.