Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 12378:ab237534d800 stable
mq: always require --force when pushing patches (issue2363)
--force was not necessary when passing --rev since 55578a8d7e84, but this
behaviour is usually harmful when branch names are passed instead of explicit
revisions.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 22 Sep 2010 23:51:10 +0200 |
parents | 5be733b20bd1 |
children | 1e2625fe371b 552e0cfbddbd |
line wrap: on
line diff
--- 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):