# HG changeset patch # User Boris Feld # Date 2018-09-19 15:09:01 # Node ID b2ec79559a4bbc8388aa66416b5a4f34a7bdfa01 # Parent 52dfa1eb0ad4f6141849a88b8389f5e08c44cf0b strip: ignore orphaned internal changesets while computing safe strip roots Internal changeset can be safely garbage collected, so we can ignore them during safestrip. (Another phase for internal changeset that must be kept in the repository might be introduced later). diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -24,6 +24,7 @@ from . import ( exchange, obsolete, obsutil, + phases, pycompat, util, ) @@ -276,7 +277,8 @@ def safestriproots(ui, repo, nodes): # orphaned = affected - wanted # affected = descendants(roots(wanted)) # wanted = revs - tostrip = set(repo.revs('%ld-(::((roots(%ld)::)-%ld))', revs, revs, revs)) + revset = '%ld - ( ::( (roots(%ld):: and not _phase(%s)) -%ld) )' + tostrip = set(repo.revs(revset, revs, revs, phases.internal, revs)) notstrip = revs - tostrip if notstrip: nodestr = ', '.join(sorted(short(repo[n].node()) for n in notstrip)) diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -669,19 +669,10 @@ shelve should leave dirstate clean (issu shelved as default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved -#if phasebased $ hg rebase -d 6c103be8f4e4 --config extensions.rebase= - rebasing 2:323bfa07f744 "xyz" + rebasing 2:323bfa07f744 "xyz"( \(tip\))? (re) merging x - warning: orphaned descendants detected, not stripping 323bfa07f744 (?) -#endif - -#if stripbased - $ hg rebase -d 6c103be8f4e4 --config extensions.rebase= - rebasing 2:323bfa07f744 "xyz" (tip) - merging x - saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-rebase.hg -#endif + saved backup bundle to \$TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-(78114325|7ae538ef)-rebase.hg (re) $ hg unshelve unshelving change 'default' rebasing shelved changes