Mercurial > hg-stable
changeset 25809:ebb5bb9bc32e
histedit: mark temporary commits as obsolete when allowed to
Before this patch, we were stripping temporary commits at the end of a histedit
whether it was successful or not. If we can create obs markers, we should
create them instead of stripping because it is faster and safer.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 16 Jul 2015 11:12:15 -0700 |
parents | 425839c8ec79 |
children | 82d6a35cf432 |
files | hgext/histedit.py tests/test-histedit-obsolete.t |
diffstat | 2 files changed, 65 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Thu Jul 16 11:17:37 2015 -0700 +++ b/hgext/histedit.py Thu Jul 16 11:12:15 2015 -0700 @@ -797,8 +797,13 @@ break else: pass - cleanupnode(ui, repo, 'created', tmpnodes) - cleanupnode(ui, repo, 'temp', leafs) + if supportsmarkers: + obsolete.createmarkers(repo, + ((repo[t],()) for t in sorted(tmpnodes))) + obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(leafs))) + else: + cleanupnode(ui, repo, 'created', tmpnodes) + cleanupnode(ui, repo, 'temp', leafs) state.clear() return else: @@ -893,8 +898,10 @@ obsolete.createmarkers(repo, markers) else: cleanupnode(ui, repo, 'replaced', mapping) - - cleanupnode(ui, repo, 'temp', tmpnodes) + if supportsmarkers: + obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes))) + else: + cleanupnode(ui, repo, 'temp', tmpnodes) state.clear() if os.path.exists(repo.sjoin('undo')): os.unlink(repo.sjoin('undo'))
--- a/tests/test-histedit-obsolete.t Thu Jul 16 11:17:37 2015 -0700 +++ b/tests/test-histedit-obsolete.t Thu Jul 16 11:12:15 2015 -0700 @@ -64,12 +64,16 @@ > fold e860deea161a 4 e > pick 652413bf663e 5 f > EOF - saved backup bundle to $TESTTMP/base/.hg/strip-backup/96e494a2d553-3c6c5d92-backup.hg (glob) + [1] $ hg log --graph --hidden - @ 8:cacdfd884a93 f + @ 10:cacdfd884a93 f + | + o 9:59d9f330561f d | - o 7:59d9f330561f d - | + | x 8:b558abc46d09 fold-temp-revision e860deea161a + | | + | x 7:96e494a2d553 d + |/ o 6:b346ab9a313d c | | x 5:652413bf663e f @@ -90,6 +94,8 @@ 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob) e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob) 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob) + 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob) + b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob) Ensure hidden revision does not prevent histedit @@ -105,7 +111,7 @@ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log --graph - @ 9:c13eb81022ca f + @ 11:c13eb81022ca f | o 6:b346ab9a313d c | @@ -127,7 +133,7 @@ $ hg up '.^' 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg log -r 'children(.)' - 9:c13eb81022ca f (no-eol) + 11:c13eb81022ca f (no-eol) $ hg histedit -r '.' --commands - <<EOF > edit b346ab9a313d 6 c > EOF @@ -141,12 +147,12 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r 'unstable()' - 9:c13eb81022ca f (no-eol) + 11:c13eb81022ca f (no-eol) stabilise $ hg rebase -r 'unstable()' -d . - rebasing 9:c13eb81022ca "f" + rebasing 11:c13eb81022ca "f" $ hg up tip -q Test dropping of changeset on the top of the stack @@ -166,7 +172,7 @@ > EOF 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg log -G - @ 10:40db8afa467b c + @ 12:40db8afa467b c | o 0:cb9a9f314b8b a @@ -188,9 +194,9 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -G - @ 15:ee6544123ab8 c + @ 17:ee6544123ab8 c | - o 14:269e713e9eae g + o 16:269e713e9eae g | o 0:cb9a9f314b8b a @@ -212,9 +218,9 @@ $ hg ph -pv '.^' phase changed for 2 changesets $ hg log -G - @ 11:b449568bf7fc (draft) f + @ 13:b449568bf7fc (draft) f | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a @@ -234,19 +240,19 @@ > done $ hg phase --force --secret .~2 $ hg log -G - @ 16:ee118ab9fa44 (secret) k + @ 18:ee118ab9fa44 (secret) k | - o 15:3a6c53ee7f3d (secret) j + o 17:3a6c53ee7f3d (secret) j | - o 14:b605fb7503f2 (secret) i + o 16:b605fb7503f2 (secret) i | - o 13:7395e1ff83bd (draft) h + o 15:7395e1ff83bd (draft) h | - o 12:6b70183d2492 (draft) g + o 14:6b70183d2492 (draft) g | - o 11:b449568bf7fc (draft) f + o 13:b449568bf7fc (draft) f | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a @@ -284,19 +290,19 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -G - @ 22:12e89af74238 (secret) k + @ 24:12e89af74238 (secret) k | - o 21:636a8687b22e (secret) j + o 23:636a8687b22e (secret) j | - o 20:ccaf0a38653f (secret) i + o 22:ccaf0a38653f (secret) i | - o 19:11a89d1c2613 (draft) h + o 21:11a89d1c2613 (draft) h | - o 18:c1dec7ca82ea (draft) g + o 20:c1dec7ca82ea (draft) g | - o 17:087281e68428 (draft) f + o 19:087281e68428 (draft) f | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a @@ -333,19 +339,19 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -G - @ 22:12e89af74238 (secret) k + @ 24:12e89af74238 (secret) k | - o 21:636a8687b22e (secret) j + o 23:636a8687b22e (secret) j | - o 20:ccaf0a38653f (secret) i + o 22:ccaf0a38653f (secret) i | - o 19:11a89d1c2613 (draft) h + o 21:11a89d1c2613 (draft) h | - o 18:c1dec7ca82ea (draft) g + o 20:c1dec7ca82ea (draft) g | - o 17:087281e68428 (draft) f + o 19:087281e68428 (draft) f | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a @@ -375,19 +381,19 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -G - @ 21:558246857888 (secret) k + @ 23:558246857888 (secret) k | - o 20:28bd44768535 (secret) h + o 22:28bd44768535 (secret) h | - o 19:d5395202aeb9 (secret) i + o 21:d5395202aeb9 (secret) i | - o 18:21edda8e341b (secret) g + o 20:21edda8e341b (secret) g | - o 17:5ab64f3a4832 (secret) j + o 19:5ab64f3a4832 (secret) j | - o 11:b449568bf7fc (draft) f + o 13:b449568bf7fc (draft) f | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a @@ -428,33 +434,30 @@ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/folding/.hg/strip-backup/58019c66f35f-96092fce-backup.hg (glob) - saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-f3469cf8-backup.hg (glob) - saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-d89a19d7-backup.hg (glob) $ hg log -G - @ 19:f9daec13fb98 (secret) i + @ 27:f9daec13fb98 (secret) i | - o 18:49807617f46a (secret) g + o 24:49807617f46a (secret) g | - o 17:050280826e04 (draft) h + o 21:050280826e04 (draft) h | - o 10:40db8afa467b (public) c + o 12:40db8afa467b (public) c | o 0:cb9a9f314b8b (public) a - $ hg co 18 + $ hg co 24 0 files updated, 0 files merged, 2 files removed, 0 files unresolved $ echo wat >> wat $ hg add wat $ hg ci -m 'add wat' created new head - $ hg merge 19 + $ hg merge 27 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m 'merge' $ echo not wat > wat $ hg ci -m 'modify wat' - $ hg histedit 17 + $ hg histedit 21 abort: cannot edit history that contains merges [255] $ cd ..