diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2418,6 +2418,18 @@ def strip(ui, repo, rev, **opts): 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 diff --git a/tests/test-mq-strip b/tests/test-mq-strip --- a/tests/test-mq-strip +++ b/tests/test-mq-strip @@ -53,3 +53,19 @@ hg parents 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 diff --git a/tests/test-mq-strip.out b/tests/test-mq-strip.out --- a/tests/test-mq-strip.out +++ b/tests/test-mq-strip.out @@ -165,3 +165,17 @@ user: test 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 diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -400,15 +400,13 @@ 2 bar qtip tip 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