D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh (Navaneeth Suresh)
phabricator at mercurial-scm.org
Fri Mar 8 13:26:45 EST 2019
navaneeth.suresh updated this revision to Diff 14400.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6027?vs=14245&id=14400
REVISION DETAIL
https://phab.mercurial-scm.org/D6027
AFFECTED FILES
hgext/mq.py
hgext/rebase.py
tests/test-mq.t
CHANGE DETAILS
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1619,3 +1619,24 @@
$ cd ..
+
+unshelve shouldn't be refusing on modified mq patch
+
+ $ hg init issue4318
+ $ cd issue4318
+ $ echo '[extensions]' >> $HGRCPATH
+ $ echo 'mq =' >> $HGRCPATH
+ $ echo 'shelve =' >> $HGRCPATH
+ $ echo a>a
+ $ hg add a
+ $ hg qnew -ma a.patch
+ $ echo a2>>a
+ $ hg shelve
+ shelved as default
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo b>b
+ $ hg add b
+ $ hg qref
+ $ hg unshelve
+ unshelving change 'default'
+ rebasing shelved changes
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1703,7 +1703,8 @@
# a partially completed rebase is blocked by mq.
if 'qtip' in repo.tags():
mqapplied = set(repo[s.node].rev() for s in repo.mq.applied)
- if set(destmap.values()) & mqapplied:
+ if (set(destmap.values()) & mqapplied and
+ not repo.vfs.exists('unshelverebasestate')):
raise error.Abort(_('cannot rebase onto an applied mq patch'))
# Get "cycle" error early by exhausting the generator.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3518,7 +3518,10 @@
delattr(self.unfiltered(), r'mq')
def abortifwdirpatched(self, errmsg, force=False):
- if self.mq.applied and self.mq.checkapplied and not force:
+ shelveinprogress = any('shelvedstate' in state
+ for state in cmdutil.unfinishedstates)
+ if (self.mq.applied and self.mq.checkapplied and not force and
+ not shelveinprogress):
parents = self.dirstate.parents()
patches = [s.node for s in self.mq.applied]
if parents[0] in patches or parents[1] in patches:
To: navaneeth.suresh, martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list