# HG changeset patch # User Pierre-Yves David # Date 1340701912 -7200 # Node ID 0b444d7c5c96222b6f1e114d5b8eb60101ea77cd # Parent 7c68899b521efc7d85dc2bccd097becb8792031e update revset vocabulary to use precursors, successors diff -r 7c68899b521e -r 0b444d7c5c96 hgext/obsolete.py --- a/hgext/obsolete.py Mon Jun 25 12:40:42 2012 +0200 +++ b/hgext/obsolete.py Tue Jun 26 11:11:52 2012 +0200 @@ -171,8 +171,8 @@ 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 @@ -183,14 +183,14 @@ 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 @@ -209,10 +209,10 @@ 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] @@ -322,8 +322,10 @@ 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 @@ -335,7 +337,7 @@ 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 ######################################### diff -r 7c68899b521e -r 0b444d7c5c96 tests/test-obsolete.t --- a/tests/test-obsolete.t Mon Jun 25 12:40:42 2012 +0200 +++ b/tests/test-obsolete.t Tue Jun 26 11:11:52 2012 +0200 @@ -5,7 +5,7 @@ > [phases] > publish=False > [alias] - > odiff=diff --rev 'limit(obsparents(.),1)' --rev . + > odiff=diff --rev 'limit(precursors(.),1)' --rev . > [extensions] > hgext.graphlog= > EOF @@ -54,7 +54,7 @@ Test that obsolete parent a properly computed - $ qlog -r 'obsparents(.)' --hidden + $ qlog -r 'precursors(.)' --hidden 2 - 4538525df7e2 $ qlog -r . @@ -89,7 +89,7 @@ - 4538525df7e2 3 - 0d3f46688ccc - $ qlog -r 'obsancestors(4)' --hidden + $ qlog -r 'allprecursors(4)' --hidden 2 - 4538525df7e2 3