Mercurial > hg
changeset 24709:69154e0ae384
strip: properly clear resolve state with --keep (issue4593)
Normal updates automatically clean up the resolve state, but strip
--keep does a "manual" update that bypasses the normal machinery. This
adds a mergestate reset.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 13 Apr 2015 07:42:25 -0500 |
parents | fb47816e1a9c |
children | 909ee6b2a024 |
files | hgext/strip.py tests/test-strip.t |
diffstat | 2 files changed, 34 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/strip.py Mon Apr 13 20:53:05 2015 -0700 +++ b/hgext/strip.py Mon Apr 13 07:42:25 2015 -0500 @@ -7,7 +7,7 @@ from mercurial.node import nullid from mercurial.lock import release from mercurial import cmdutil, hg, scmutil, util -from mercurial import repair, bookmarks +from mercurial import repair, bookmarks, merge cmdtable = {} command = cmdutil.command(cmdtable) @@ -205,6 +205,11 @@ repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) repo.dirstate.write() + + # clear resolve state + ms = merge.mergestate(repo) + ms.reset(repo['.'].node()) + update = False
--- a/tests/test-strip.t Mon Apr 13 20:53:05 2015 -0700 +++ b/tests/test-strip.t Mon Apr 13 07:42:25 2015 -0500 @@ -496,10 +496,11 @@ Verify strip protects against stripping wc parent when there are uncommitted mods $ echo b > b + $ echo bb > bar $ hg add b $ hg ci -m 'b' $ hg log --graph - @ changeset: 1:7519abd79d14 + @ changeset: 1:76dcf9fab855 | tag: tip | user: test | date: Thu Jan 01 00:00:00 1970 +0000 @@ -510,9 +511,24 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: a + $ hg up 0 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo c > bar + $ hg up -t false + merging bar + merging bar failed! + 1 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges + [1] + $ hg sum + parent: 1:76dcf9fab855 tip + b + branch: default + commit: 1 modified, 1 unknown, 1 unresolved + update: (current) + mq: 3 unapplied $ echo c > b - $ echo c > bar $ hg strip tip abort: local changes found [255] @@ -528,6 +544,16 @@ $ hg status M bar ? b + ? bar.orig + + $ rm bar.orig + $ hg sum + parent: 0:9ab35a2d17cb tip + a + branch: default + commit: 1 modified, 1 unknown + update: (current) + mq: 3 unapplied Strip adds, removes, modifies with --keep