D2579: WIP: fix unshelve refuses to apply on modified MQ patch (issue4318)

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Sat Mar 3 14:33:55 UTC 2018


khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2579

AFFECTED FILES
  hgext/mq.py
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1634,10 +1634,11 @@
     # This check isn't strictly necessary, since mq detects commits over an
     # applied patch. But it prevents messing up the working directory when
     # 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:
-            raise error.Abort(_('cannot rebase onto an applied mq patch'))
+    if not repo.vfs.readlines('journal.desc')[1] == 'unshelve\n':
+        if 'qtip' in repo.tags():
+            mqapplied = set(repo[s.node].rev() for s in repo.mq.applied)
+            if set(destmap.values()) & mqapplied:
+                raise error.Abort(_('cannot rebase onto an applied mq patch'))
 
     # Get "cycle" error early by exhausting the generator.
     sortedsrc = list(sortsource(destmap)) # a list of sorted revs
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3482,9 +3482,10 @@
                    force=False, editor=False, extra=None):
             if extra is None:
                 extra = {}
-            self.abortifwdirpatched(
-                _('cannot commit over an applied mq patch'),
-                force)
+            if not repo.vfs.readlines('journal.desc')[1] == 'unshelve\n':
+                self.abortifwdirpatched(
+                    _('cannot commit over an applied mq patch'),
+                    force)
 
             return super(mqrepo, self).commit(text, user, date, match, force,
                                               editor, extra)



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list