Mercurial > hg
changeset 11637:64f284da1278 stable
mq: cleanup status if applied mq is stripped (issue1881)
stripping of applied mq patches leads to wrong state recorded in status
file. find all mq patches that will be affected and clean up status file
before strip.
author | Vishakh H <vsh426@gmail.com> |
---|---|
date | Tue, 20 Jul 2010 20:37:29 +0530 |
parents | c10eaf1210cd |
children | 79231258503b |
files | hgext/mq.py tests/test-mq-strip tests/test-mq-strip.out tests/test-mq.out |
diffstat | 4 files changed, 43 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Jul 20 18:29:00 2010 +0900 +++ b/hgext/mq.py Tue Jul 20 20:37:29 2010 +0530 @@ -2418,6 +2418,18 @@ elif rev not in (cl.ancestor(p[0], rev), cl.ancestor(p[1], rev)): update = False + q = repo.mq + if q.applied: + if rev == cl.ancestor(repo.lookup('qtip'), rev): + q.applied_dirty = True + start = 0 + end = len(q.applied) + applied_list = [i.node for i in q.applied] + if rev in applied_list: + start = applied_list.index(rev) + del q.applied[start:end] + q.save_dirty() + repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force']) return 0
--- a/tests/test-mq-strip Tue Jul 20 18:29:00 2010 +0900 +++ b/tests/test-mq-strip Tue Jul 20 20:37:29 2010 +0530 @@ -53,3 +53,19 @@ hg strip 4 2>&1 | hidebackup echo % after strip of merge parent hg parents + +#strip of applied mq should cleanup status file +hg up -C 3 +echo fooagain >> bar +hg ci -mf +hg qimport -r tip:2 +echo % applied patches before strip +hg qapplied +echo % stripping revision in queue +hg strip 3 | hidebackup +echo % applied patches after stripping rev in queue +hg qapplied +echo % stripping ancestor of queue +hg strip 1 | hidebackup +echo % applied patches after stripping ancestor of queue +hg qapplied
--- a/tests/test-mq-strip.out Tue Jul 20 18:29:00 2010 +0900 +++ b/tests/test-mq-strip.out Tue Jul 20 20:37:29 2010 +0530 @@ -165,3 +165,17 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: b +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +% applied patches before strip +2.diff +3.diff +4.diff +% stripping revision in queue +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +% applied patches after stripping rev in queue +2.diff +% stripping ancestor of queue +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +% applied patches after stripping ancestor of queue
--- a/tests/test-mq.out Tue Jul 20 18:29:00 2010 +0900 +++ b/tests/test-mq.out Tue Jul 20 20:37:29 2010 +0530 @@ -400,15 +400,13 @@ popping bar now at: foo changeset: 0:cb9a9f314b8b -mq status file refers to unknown node tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: a -mq status file refers to unknown node default 0:cb9a9f314b8b -abort: trying to pop unknown node +no patches applied new file diff --git a/new b/new