##// END OF EJS Templates
partial backout of 1e819576e926 and add tests (issue2131)...
Sune Foldager -
r10875:a9702c47 stable
parent child Browse files
Show More
@@ -1517,8 +1517,15 b' class localrepository(repo.repository):'
1517 if len(lheads) > len(rheads):
1517 if len(lheads) > len(rheads):
1518 warn = 1
1518 warn = 1
1519 else:
1519 else:
1520 # add local heads involved in the push
1521 updatelheads = [self.changelog.heads(x, lheads)
1522 for x in update]
1523 newheads = set(sum(updatelheads, [])) & set(lheads)
1524
1525 if not newheads:
1526 return True
1527
1520 # add heads we don't have or that are not involved in the push
1528 # add heads we don't have or that are not involved in the push
1521 newheads = set(lheads)
1522 for r in rheads:
1529 for r in rheads:
1523 if r in self.changelog.nodemap:
1530 if r in self.changelog.nodemap:
1524 desc = self.changelog.heads(r, heads)
1531 desc = self.changelog.heads(r, heads)
@@ -1,5 +1,8 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "graphlog=" >> $HGRCPATH
5
3 mkdir a
6 mkdir a
4 cd a
7 cd a
5 hg init
8 hg init
@@ -193,5 +196,72 b" hg -q ci -d '0 0' -mb2"
193 hg -q merge 3
196 hg -q merge 3
194 hg -q ci -d '0 0' -mma
197 hg -q ci -d '0 0' -mma
195 hg push ../l -b b
198 hg push ../l -b b
199 cd ..
200
201 echo % check prepush with new branch head on former topo non-head
202 hg init n
203 cd n
204 hg branch A
205 echo a >a
206 hg ci -Ama
207 hg branch B
208 echo b >b
209 hg ci -Amb
210 # b is now branch head of B, and a topological head
211 # a is now branch head of A, but not a topological head
212 hg clone . inner
213 cd inner
214 hg up B
215 echo b1 >b1
216 hg ci -Amb1
217 # in the clone b1 is now the head of B
218 cd ..
219 hg up 0
220 echo a2 >a2
221 hg ci -Ama2
222 # a2 is now the new branch head of A, and a new topological head
223 # it replaces a former inner branch head, so it should at most warn about A, not B
224 echo %% glog of local
225 hg glog --template "{rev}: {branches} {desc}\n"
226 echo %% glog of remote
227 hg glog -R inner --template "{rev}: {branches} {desc}\n"
228 echo %% outgoing
229 hg out inner --template "{rev}: {branches} {desc}\n"
230 hg push inner
231 cd ..
232
233 echo % check prepush with new branch head on former topo head
234 hg init o
235 cd o
236 hg branch A
237 echo a >a
238 hg ci -Ama
239 hg branch B
240 echo b >b
241 hg ci -Amb
242 # b is now branch head of B, and a topological head
243 hg up 0
244 echo a1 >a1
245 hg ci -Ama1
246 # a1 is now branch head of A, and a topological head
247 hg clone . inner
248 cd inner
249 hg up B
250 echo b1 >b1
251 hg ci -Amb1
252 # in the clone b1 is now the head of B
253 cd ..
254 echo a2 >a2
255 hg ci -Ama2
256 # a2 is now the new branch head of A, and a topological head
257 # it replaces a former topological and branch head, so this should not warn
258 echo %% glog of local
259 hg glog --template "{rev}: {branches} {desc}\n"
260 echo %% glog of remote
261 hg glog -R inner --template "{rev}: {branches} {desc}\n"
262 echo %% outgoing
263 hg out inner --template "{rev}: {branches} {desc}\n"
264 hg push inner
265 cd ..
196
266
197 exit 0
267 exit 0
@@ -175,3 +175,82 b' pushing to ../l'
175 searching for changes
175 searching for changes
176 abort: push creates new remote heads on branch 'a'!
176 abort: push creates new remote heads on branch 'a'!
177 (did you forget to merge? use push -f to force)
177 (did you forget to merge? use push -f to force)
178 % check prepush with new branch head on former topo non-head
179 marked working directory as branch A
180 adding a
181 marked working directory as branch B
182 adding b
183 updating to branch B
184 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 adding b1
187 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
188 adding a2
189 created new head
190 %% glog of local
191 @ 2: A a2
192 |
193 | o 1: B b
194 |/
195 o 0: A a
196
197 %% glog of remote
198 @ 2: B b1
199 |
200 o 1: B b
201 |
202 o 0: A a
203
204 %% outgoing
205 comparing with inner
206 searching for changes
207 2: A a2
208 pushing to inner
209 searching for changes
210 note: unsynced remote changes!
211 adding changesets
212 adding manifests
213 adding file changes
214 added 1 changesets with 1 changes to 1 files (+1 heads)
215 % check prepush with new branch head on former topo head
216 marked working directory as branch A
217 adding a
218 marked working directory as branch B
219 adding b
220 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
221 adding a1
222 created new head
223 updating to branch A
224 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
226 adding b1
227 adding a2
228 %% glog of local
229 @ 3: A a2
230 |
231 o 2: A a1
232 |
233 | o 1: B b
234 |/
235 o 0: A a
236
237 %% glog of remote
238 @ 3: B b1
239 |
240 | o 2: A a1
241 | |
242 o | 1: B b
243 |/
244 o 0: A a
245
246 %% outgoing
247 comparing with inner
248 searching for changes
249 3: A a2
250 pushing to inner
251 searching for changes
252 note: unsynced remote changes!
253 adding changesets
254 adding manifests
255 adding file changes
256 added 1 changesets with 1 changes to 1 files
General Comments 0
You need to be logged in to leave comments. Login now