# HG changeset patch # User Pierre-Yves David # Date 1529198974 -7200 # Node ID e0bf44befd6e36039f991ac540094d0d03141c20 # Parent bbfbaf46f7b09cd6c112306f1f3e967dff1ab7fa evolve: exclude "identical" precursors from the precursors set I'm not sure it is the right thing to do, but it simply thing a lot for now. Otherwise, using 'precursors' to find rewind direction become too complex. This is going to give problematic result in case of prune. Since there are no other precursors to follow. diff -r bbfbaf46f7b0 -r e0bf44befd6e hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Sun Jun 17 03:07:53 2018 +0200 +++ b/hgext3rd/evolve/__init__.py Sun Jun 17 03:29:34 2018 +0200 @@ -533,7 +533,7 @@ # XXX SOME MAJOR CLEAN UP TO DO HERE XXX -def _precursors(repo, s): +def _precursors(repo, s, includeidentical=False): """Precursor of a changeset""" cs = set() nm = repo.changelog.nodemap @@ -541,6 +541,8 @@ node = repo.changelog.node for r in s: for p in markerbysubj.get(node(r), ()): + if not includeidentical and p[2] & rewind.identicalflag: + continue pr = nm.get(p[0]) if pr is not None: cs.add(pr) diff -r bbfbaf46f7b0 -r e0bf44befd6e tests/test-rewind.t --- a/tests/test-rewind.t Sun Jun 17 03:07:53 2018 +0200 +++ b/tests/test-rewind.t Sun Jun 17 03:29:34 2018 +0200 @@ -752,7 +752,7 @@ ``````` $ echo 'default-date = 4 0' >> $HGRCPATH - $ hg rewind --hidden --to 'max(precursors(.))' + $ hg rewind --hidden --to 'precursors(.)' rewinded to 1 changesets (1 changesets obsoleted) working directory is now at 7b1440274cc3 @@ -800,7 +800,7 @@ Automaticlaly rewinding the full stack -------------------------------------- - $ hg rewind --hidden --to 'max(precursors(.))' + $ hg rewind --hidden --to 'precursors(.)' rewinded to 2 changesets (2 changesets obsoleted) working directory is now at 70892f498f29