Show More
@@ -1531,13 +1531,7 class localrepository(repo.repository): | |||||
1531 | warn = 1 |
|
1531 | warn = 1 | |
1532 |
|
1532 | |||
1533 | if warn: |
|
1533 | if warn: | |
1534 | if not rheads: # new branch requires --force |
|
|||
1535 | self.ui.warn(_("abort: push creates new" |
|
|||
1536 | " remote branch '%s'!\n") % |
|
|||
1537 | self[lheads[0]].branch()) |
|
|||
1538 | else: |
|
|||
1539 |
|
|
1534 | self.ui.warn(_("abort: push creates new remote heads!\n")) | |
1540 |
|
||||
1541 | self.ui.status(_("(did you forget to merge?" |
|
1535 | self.ui.status(_("(did you forget to merge?" | |
1542 | " use push -f to force)\n")) |
|
1536 | " use push -f to force)\n")) | |
1543 | return False |
|
1537 | return False | |
@@ -1568,8 +1562,18 class localrepository(repo.repository): | |||||
1568 | branch = self[n].branch() |
|
1562 | branch = self[n].branch() | |
1569 | localbrheads.setdefault(branch, []).append(n) |
|
1563 | localbrheads.setdefault(branch, []).append(n) | |
1570 |
|
1564 | |||
|
1565 | newbranches = list(set(localbrheads) - set(remotebrheads)) | |||
|
1566 | if newbranches: # new branch requires --force | |||
|
1567 | branchnames = ', '.join("'%s'" % b for b in newbranches) | |||
|
1568 | self.ui.warn(_("abort: push creates " | |||
|
1569 | "new remote branches: %s!\n") | |||
|
1570 | % branchnames) | |||
|
1571 | # propose 'push -b .' in the msg too? | |||
|
1572 | self.ui.status(_("(use 'hg push -f' to force)\n")) | |||
|
1573 | return None, 0 | |||
1571 | for branch, lheads in localbrheads.iteritems(): |
|
1574 | for branch, lheads in localbrheads.iteritems(): | |
1572 |
|
|
1575 | if branch in remotebrheads: | |
|
1576 | rheads = remotebrheads[branch] | |||
1573 | if not checkbranch(lheads, rheads, update): |
|
1577 | if not checkbranch(lheads, rheads, update): | |
1574 | return None, 0 |
|
1578 | return None, 0 | |
1575 | else: |
|
1579 | else: |
@@ -90,38 +90,47 hg -q up 0 | |||||
90 | echo 5 > foo |
|
90 | echo 5 > foo | |
91 | hg -q branch c |
|
91 | hg -q branch c | |
92 | hg -q ci -d "1000000 0" -m 5 |
|
92 | hg -q ci -d "1000000 0" -m 5 | |
|
93 | hg push ../f; echo $? | |||
93 | hg push -r 4 -r 5 ../f; echo $? |
|
94 | hg push -r 4 -r 5 ../f; echo $? | |
94 |
|
95 | |||
|
96 | echo % multiple new branches | |||
|
97 | hg -q branch d | |||
|
98 | echo 6 > foo | |||
|
99 | hg -q ci -d "1000000 0" -m 6 | |||
|
100 | hg push ../f; echo $? | |||
|
101 | hg push -r 4 -r 6 ../f; echo $? | |||
|
102 | cd ../g | |||
|
103 | ||||
95 | echo % fail on multiple head push |
|
104 | echo % fail on multiple head push | |
96 | hg -q up 1 |
|
105 | hg -q up 1 | |
97 |
echo |
|
106 | echo 7 > foo | |
98 |
hg -q ci -d "1000000 0" -m |
|
107 | hg -q ci -d "1000000 0" -m 7 | |
99 |
hg push -r 4 -r |
|
108 | hg push -r 4 -r 7 ../f; echo $? | |
100 |
|
109 | |||
101 | echo % push replacement head on existing branches |
|
110 | echo % push replacement head on existing branches | |
102 | hg -q up 3 |
|
111 | hg -q up 3 | |
103 |
echo |
|
112 | echo 8 > foo | |
104 |
hg -q ci -d "1000000 0" -m |
|
113 | hg -q ci -d "1000000 0" -m 8 | |
105 |
hg push -r |
|
114 | hg push -r 7 -r 8 ../f; echo $? | |
106 |
|
115 | |||
107 | echo % merge of branch a to other branch b followed by unrelated push on branch a |
|
116 | echo % merge of branch a to other branch b followed by unrelated push on branch a | |
108 | hg -q up 6 |
|
|||
109 | HGMERGE=true hg -q merge 7 |
|
|||
110 | hg -q ci -d "1000000 0" -m 8 |
|
|||
111 | hg -q up 7 |
|
117 | hg -q up 7 | |
112 | echo 9 > foo |
|
118 | HGMERGE=true hg -q merge 8 | |
113 | hg -q ci -d "1000000 0" -m 9 |
|
119 | hg -q ci -d "1000000 0" -m 9 | |
114 | hg push -r 8 ../f; echo $? |
|
120 | hg -q up 8 | |
|
121 | echo 10 > foo | |||
|
122 | hg -q ci -d "1000000 0" -m 10 | |||
115 | hg push -r 9 ../f; echo $? |
|
123 | hg push -r 9 ../f; echo $? | |
|
124 | hg push -r 10 ../f; echo $? | |||
116 |
|
125 | |||
117 | echo % cheating the counting algorithm |
|
126 | echo % cheating the counting algorithm | |
118 |
hg -q up |
|
127 | hg -q up 9 | |
119 | HGMERGE=true hg -q merge 2 |
|
128 | HGMERGE=true hg -q merge 2 | |
120 |
hg -q ci -d "1000000 0" -m 1 |
|
129 | hg -q ci -d "1000000 0" -m 11 | |
121 | hg -q up 1 |
|
130 | hg -q up 1 | |
122 |
echo 1 |
|
131 | echo 12 > foo | |
123 |
hg -q ci -d "1000000 0" -m 1 |
|
132 | hg -q ci -d "1000000 0" -m 12 | |
124 |
hg push -r 1 |
|
133 | hg push -r 11 -r 12 ../f; echo $? | |
125 |
|
134 | |||
126 | echo % checking prepush logic does not allow silently pushing multiple new heads |
|
135 | echo % checking prepush logic does not allow silently pushing multiple new heads | |
127 | cd .. |
|
136 | cd .. |
@@ -84,8 +84,24 0 | |||||
84 | % push on existing branch and new branch |
|
84 | % push on existing branch and new branch | |
85 | pushing to ../f |
|
85 | pushing to ../f | |
86 | searching for changes |
|
86 | searching for changes | |
87 | abort: push creates new remote branch 'c'! |
|
87 | abort: push creates new remote branches: 'c'! | |
88 | (did you forget to merge? use push -f to force) |
|
88 | (use 'hg push -f' to force) | |
|
89 | 1 | |||
|
90 | pushing to ../f | |||
|
91 | searching for changes | |||
|
92 | abort: push creates new remote branches: 'c'! | |||
|
93 | (use 'hg push -f' to force) | |||
|
94 | 1 | |||
|
95 | % multiple new branches | |||
|
96 | pushing to ../f | |||
|
97 | searching for changes | |||
|
98 | abort: push creates new remote branches: 'c', 'd'! | |||
|
99 | (use 'hg push -f' to force) | |||
|
100 | 1 | |||
|
101 | pushing to ../f | |||
|
102 | searching for changes | |||
|
103 | abort: push creates new remote branches: 'd'! | |||
|
104 | (use 'hg push -f' to force) | |||
89 | 1 |
|
105 | 1 | |
90 | % fail on multiple head push |
|
106 | % fail on multiple head push | |
91 | pushing to ../f |
|
107 | pushing to ../f |
General Comments 0
You need to be logged in to leave comments.
Login now