Mercurial > public > mercurial-scm > hg
diff tests/test-rebase-collapse.t @ 17013:c8eda7bbdcab
strip: incrementally update the branchheads cache after a strip
This function augments strip to incrementally update the branchheads cache
rather than recompute it from scratch. This speeds up the performance of strip
and rebase on repos with long history. The performance optimization only
happens if the revisions stripped are all on the same branch and the parents of
the stripped revisions are also on that same branch.
This adds a few test cases, particularly one that reproduces the extra heads
that mpm observed.
author | Joshua Redstone <joshua.redstone@fb.com> |
---|---|
date | Fri, 18 May 2012 12:45:47 -0700 |
parents | 50f434510da6 |
children | ec5ef276077f |
line wrap: on
line diff
--- a/tests/test-rebase-collapse.t Fri Jun 01 08:56:17 2012 -0700 +++ b/tests/test-rebase-collapse.t Fri May 18 12:45:47 2012 -0700 @@ -2,6 +2,7 @@ > [extensions] > graphlog= > rebase= + > mq= > > [phases] > publish=False @@ -259,6 +260,44 @@ $ cd .. + + +Test that branchheads cache is updated correctly when doing a strip in which +the parent of the ancestor node to be stripped does not become a head and +also, the parent of a node that is a child of the node stripped becomes a head +(node 3). + + $ hg clone -q -u . b b2 + $ cd b2 + + $ hg heads --template="{rev}:{node} {branch}\n" + 7:c65502d4178782309ce0574c5ae6ee9485a9bafa default + 6:c772a8b2dc17629cec88a19d09c926c4814b12c7 default + + $ cat $TESTTMP/b2/.hg/cache/branchheads + c65502d4178782309ce0574c5ae6ee9485a9bafa 7 + c772a8b2dc17629cec88a19d09c926c4814b12c7 default + c65502d4178782309ce0574c5ae6ee9485a9bafa default + + $ hg strip 4 + saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-backup.hg + + $ cat $TESTTMP/b2/.hg/cache/branchheads + c65502d4178782309ce0574c5ae6ee9485a9bafa 4 + 2870ad076e541e714f3c2bc32826b5c6a6e5b040 default + c65502d4178782309ce0574c5ae6ee9485a9bafa default + + $ hg heads --template="{rev}:{node} {branch}\n" + 4:c65502d4178782309ce0574c5ae6ee9485a9bafa default + 3:2870ad076e541e714f3c2bc32826b5c6a6e5b040 default + + $ cd .. + + + + + + Create repo c: $ hg init c @@ -628,3 +667,56 @@ b b $ cd .. + + +Test stripping a revision with another child + + $ hg init f + $ cd f + + $ echo A > A + $ hg ci -Am A + adding A + $ echo B > B + $ hg ci -Am B + adding B + + $ hg up -q 0 + + $ echo C > C + $ hg ci -Am C + adding C + created new head + + $ hg tglog + @ 2: 'C' + | + | o 1: 'B' + |/ + o 0: 'A' + + + + $ hg heads --template="{rev}:{node} {branch}: {desc}\n" + 2:c5cefa58fd557f84b72b87f970135984337acbc5 default: C + 1:27547f69f25460a52fff66ad004e58da7ad3fb56 default: B + + $ hg strip 2 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + saved backup bundle to $TESTTMP/f/.hg/strip-backup/*-backup.hg (glob) + + $ hg tglog + o 1: 'B' + | + @ 0: 'A' + + + + $ hg heads --template="{rev}:{node} {branch}: {desc}\n" + 1:27547f69f25460a52fff66ad004e58da7ad3fb56 default: B + + $ cd .. + + + +