--- a/mercurial/localrepo.py Sat Nov 28 23:58:03 2009 +0100
+++ b/mercurial/localrepo.py Mon Nov 30 16:53:05 2009 +0100
@@ -1526,7 +1526,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"))
@@ -1569,11 +1569,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:58:03 2009 +0100
+++ b/tests/test-push-warn Mon Nov 30 16:53:05 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:58:03 2009 +0100
+++ b/tests/test-push-warn.out Mon Nov 30 16:53:05 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)
+