hgext/mq.py
branchstable
changeset 12378 ab237534d800
parent 12352 5be733b20bd1
child 12380 1e2625fe371b
child 12507 552e0cfbddbd
--- a/hgext/mq.py	Tue Sep 21 23:14:58 2010 +0200
+++ b/hgext/mq.py	Wed Sep 22 23:51:10 2010 +0200
@@ -2713,8 +2713,16 @@
                                               editor, extra)
 
         def push(self, remote, force=False, revs=None, newbranch=False):
-            if self.mq.applied and not force and not revs:
-                raise util.Abort(_('source has mq patches applied'))
+            if self.mq.applied and not force:
+                haspatches = True
+                if revs:
+                    # Assume applied patches have no non-patch descendants
+                    # and are not on remote already. If they appear in the
+                    # set of resolved 'revs', bail out.
+                    applied = set(e.node for e in self.mq.applied)
+                    haspatches = bool([n for n in revs if n in applied])
+                if haspatches:
+                    raise util.Abort(_('source has mq patches applied'))
             return super(mqrepo, self).push(remote, force, revs, newbranch)
 
         def _findtags(self):