Mercurial > hg
changeset 9954:d6a307719ccb stable
fix bug in prepush logic involving merge changesets
When creating new branches and merging them into existing ones, you would
sometimes be able to push some changesets (the existing branches) without using
--force, even when that creates a new head on the remote.
A test which triggers the error has been added.
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Mon, 30 Nov 2009 14:58:52 +0100 |
parents | 5b149c88d9e8 |
children | 7bcbdefcd93a 6045a8c4dbbc |
files | mercurial/localrepo.py tests/test-push-warn tests/test-push-warn.out |
diffstat | 3 files changed, 33 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Nov 28 23:44:18 2009 +0100 +++ b/mercurial/localrepo.py Mon Nov 30 14:58:52 2009 +0100 @@ -1505,7 +1505,7 @@ if not rheads: # new branch requires --force self.ui.warn(_("abort: push creates new" " remote branch '%s'!\n") % - self[updatelb[0]].branch()) + self[lheads[0]].branch()) else: self.ui.warn(_("abort: push creates new remote heads!\n")) @@ -1548,11 +1548,7 @@ else: rheads = [] lheads = localhds[lh] - updatelb = [upd for upd in update - if self[upd].branch() == lh] - if not updatelb: - continue - if not checkbranch(lheads, rheads, updatelb): + if not checkbranch(lheads, rheads, update): return None, 0 else: if not checkbranch(heads, remote_heads, update):
--- a/tests/test-push-warn Sat Nov 28 23:44:18 2009 +0100 +++ b/tests/test-push-warn Mon Nov 30 14:58:52 2009 +0100 @@ -140,4 +140,21 @@ hg -R i push h echo +echo % check prepush logic with merged branches +hg init j +hg -R j branch a +echo init > j/foo +hg -R j ci -Am init +hg clone j k +echo a1 > j/foo +hg -R j ci -m a1 +hg -R k branch b +echo b > k/foo +hg -R k ci -m b +hg -R k up 0 +hg -R k merge b +hg -R k ci -m merge +hg -R k push -r a j +echo + exit 0
--- a/tests/test-push-warn.out Sat Nov 28 23:44:18 2009 +0100 +++ b/tests/test-push-warn.out Mon Nov 30 14:58:52 2009 +0100 @@ -140,3 +140,17 @@ abort: push creates new remote heads! (did you forget to merge? use push -f to force) +% check prepush logic with merged branches +marked working directory as branch a +adding foo +updating to branch a +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +marked working directory as branch b +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +pushing to j +searching for changes +abort: push creates new remote heads! +(did you forget to merge? use push -f to force) +