##// END OF EJS Templates
mq-safety: don't apply safety on non-outgoing changeset...
Pierre-Yves David -
r15952:ec8a9e06 stable
parent child Browse files
Show More
@@ -3161,15 +3161,22 b' def reposetup(ui, repo):'
3161
3161
3162 def checkpush(self, force, revs):
3162 def checkpush(self, force, revs):
3163 if self.mq.applied and not force:
3163 if self.mq.applied and not force:
3164 haspatches = True
3164 outapplied = [e.node for e in self.mq.applied]
3165 if revs:
3165 if revs:
3166 # Assume applied patches have no non-patch descendants
3166 # Assume applied patches have no non-patch descendants and
3167 # and are not on remote already. If they appear in the
3167 # are not on remote already. Filtering any changeset not
3168 # set of resolved 'revs', bail out.
3168 # pushed.
3169 applied = set(e.node for e in self.mq.applied)
3169 heads = set(revs)
3170 haspatches = bool([n for n in revs if n in applied])
3170 for node in reversed(outapplied):
3171 if haspatches:
3171 if node in heads:
3172 raise util.Abort(_('source has mq patches applied'))
3172 break
3173 else:
3174 outapplied.pop()
3175 # looking for pushed and shared changeset
3176 for node in outapplied:
3177 if repo[node].phase() < phases.secret:
3178 raise util.Abort(_('source has mq patches applied'))
3179 # no non-secret patches pushed
3173 super(mqrepo, self).checkpush(force, revs)
3180 super(mqrepo, self).checkpush(force, revs)
3174
3181
3175 def _findtags(self):
3182 def _findtags(self):
@@ -1597,14 +1597,14 b' class localrepository(repo.repository):'
1597 # unbundle assumes local user cannot lock remote repo (new ssh
1597 # unbundle assumes local user cannot lock remote repo (new ssh
1598 # servers, http servers).
1598 # servers, http servers).
1599
1599
1600 self.checkpush(force, revs)
1600 # get local lock as we might write phase data
1601 lock = None
1601 locallock = self.lock()
1602 unbundle = remote.capable('unbundle')
1603 if not unbundle:
1604 lock = remote.lock()
1605 try:
1602 try:
1606 # get local lock as we might write phase data
1603 self.checkpush(force, revs)
1607 locallock = self.lock()
1604 lock = None
1605 unbundle = remote.capable('unbundle')
1606 if not unbundle:
1607 lock = remote.lock()
1608 try:
1608 try:
1609 # discovery
1609 # discovery
1610 fci = discovery.findcommonincoming
1610 fci = discovery.findcommonincoming
@@ -1687,10 +1687,10 b' class localrepository(repo.repository):'
1687 self.ui.warn(_('updating %s to public failed!\n')
1687 self.ui.warn(_('updating %s to public failed!\n')
1688 % newremotehead)
1688 % newremotehead)
1689 finally:
1689 finally:
1690 locallock.release()
1690 if lock is not None:
1691 lock.release()
1691 finally:
1692 finally:
1692 if lock is not None:
1693 locallock.release()
1693 lock.release()
1694
1694
1695 self.ui.debug("checking for updated bookmarks\n")
1695 self.ui.debug("checking for updated bookmarks\n")
1696 rb = remote.listkeys('bookmarks')
1696 rb = remote.listkeys('bookmarks')
@@ -144,7 +144,18 b' Testing applied patches, push and --forc'
144
144
145 Pushing applied patch with --rev without --force
145 Pushing applied patch with --rev without --force
146
146
147 $ hg push -r default ../forcepush2
147 All secret
148
149 $ hg push -r . ../forcepush2
150 pushing to ../forcepush2
151 searching for changes
152 no changes to push but 1 secret changesets
153
154 some draft
155
156 $ hg phase --draft 'mq()'
157
158 $ hg push -r . ../forcepush2
148 pushing to ../forcepush2
159 pushing to ../forcepush2
149 abort: source has mq patches applied
160 abort: source has mq patches applied
150 [255]
161 [255]
@@ -168,11 +179,12 b' Pushing revs excluding applied patch'
168
179
169 Pushing applied patch with --force
180 Pushing applied patch with --force
170
181
182 $ hg phase --force --secret 'mq()'
171 $ hg push --force -r default ../forcepush2
183 $ hg push --force -r default ../forcepush2
172 pushing to ../forcepush2
184 pushing to ../forcepush2
173 searching for changes
185 searching for changes
174 no changes to push but 1 secret changesets
186 no changes to push but 1 secret changesets
175 $ hg phase -d 'mq()'
187 $ hg phase --draft 'mq()'
176 $ hg push --force -r default ../forcepush2
188 $ hg push --force -r default ../forcepush2
177 pushing to ../forcepush2
189 pushing to ../forcepush2
178 searching for changes
190 searching for changes
@@ -393,8 +393,9 b' commit should fail'
393 abort: cannot commit over an applied mq patch
393 abort: cannot commit over an applied mq patch
394 [255]
394 [255]
395
395
396 push should fail
396 push should fail if draft
397
397
398 $ hg phase --draft 'mq()'
398 $ hg push ../../k
399 $ hg push ../../k
399 pushing to ../../k
400 pushing to ../../k
400 abort: source has mq patches applied
401 abort: source has mq patches applied
General Comments 0
You need to be logged in to leave comments. Login now