Mercurial > hg
comparison hgext/mq.py @ 15952:ec8a9e06cf05 stable
mq-safety: don't apply safety on non-outgoing changeset
When mq changeset are secret, they don't appear in outgoing and won't be
pushed. So it's not necessary to abort the push.
The checkpush call is protected by lock to prevent race on phase.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 20 Jan 2012 18:45:29 +0100 |
parents | 9d4b5c3cb853 |
children | 341c58282b25 |
comparison
equal
deleted
inserted
replaced
15951:bd84fc0b5f64 | 15952:ec8a9e06cf05 |
---|---|
3159 return super(mqrepo, self).commit(text, user, date, match, force, | 3159 return super(mqrepo, self).commit(text, user, date, match, force, |
3160 editor, extra) | 3160 editor, extra) |
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): |
3176 '''augment tags from base class with patch tags''' | 3183 '''augment tags from base class with patch tags''' |
3177 result = super(mqrepo, self)._findtags() | 3184 result = super(mqrepo, self)._findtags() |