Mercurial > hg-stable
changeset 12380:1e2625fe371b
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 22 Sep 2010 18:29:41 -0500 |
parents | a5b77eb0409b (current diff) 6aa2c86db2eb (diff) |
children | f1e8d6f6e682 |
files | hgext/mq.py tests/test-archive.t tests/test-mq-safety.t |
diffstat | 2 files changed, 74 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Wed Sep 22 18:20:47 2010 -0500 +++ b/hgext/mq.py Wed Sep 22 18:29:41 2010 -0500 @@ -2797,8 +2797,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):
--- a/tests/test-mq-safety.t Wed Sep 22 18:20:47 2010 -0500 +++ b/tests/test-mq-safety.t Wed Sep 22 18:29:41 2010 -0500 @@ -110,3 +110,67 @@ $ hg qpush applying qp now at: qp + +Testing applied patches, push and --force + + $ cd .. + $ hg init forcepush + $ cd forcepush + $ echo a > a + $ hg ci -Am adda + adding a + $ echo a >> a + $ hg ci -m changea + $ hg up 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg branch branch + marked working directory as branch branch + $ echo b > b + $ hg ci -Am addb + adding b + $ hg up 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg --cwd .. clone -r 0 forcepush forcepush2 + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo a >> a + $ hg qnew patch + +Pushing applied patch with --rev without --force + + $ hg push -r default ../forcepush2 + pushing to ../forcepush2 + abort: source has mq patches applied + [255] + +Pushing applied patch with branchhash, without --force + + $ hg push ../forcepush2#default + pushing to ../forcepush2 + abort: source has mq patches applied + [255] + +Pushing revs excluding applied patch + + $ hg push --new-branch -r branch -r 2 ../forcepush2 + pushing to ../forcepush2 + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + +Pushing applied patch with --force + + $ hg push --force -r default ../forcepush2 + pushing to ../forcepush2 + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads)