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

login
register
mail settings
Submitter phabricator
Date March 3, 2018, 2:33 p.m.
Message ID <differential-rev-PHID-DREV-zqlmp4aagh5bmr4tgqo6-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28777/
State Superseded
Headers show

Comments

phabricator - March 3, 2018, 2:33 p.m.
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




To: khanchi97, #hg-reviewers
Cc: mercurial-devel
phabricator - March 3, 2018, 2:39 p.m.
khanchi97 added a comment.


  I don't know if this is the right way to catch `unshelve` run because it is breaking so many things. May be there is some other way to catch a `unshelve` run so that I can disable those checks. Although it is working for the case mentioned in the issue.

REPOSITORY
  rHG Mercurial

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

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

Patch

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)