##// END OF EJS Templates
merge default
Thomas Arendsen Hein -
r10879:29030b7f merge default
parent child Browse files
Show More
@@ -0,0 +1,19 b''
1 #!/bin/sh
2
3 # test update logic when there are renames
4
5
6 # update with local changes across a file rename
7 hg init a
8 cd a
9 echo a > a
10 hg add a
11 hg ci -m a
12 hg mv a b
13 hg ci -m rename
14 echo b > b
15 hg ci -m change
16 hg up -q 0
17 echo c > a
18 hg up
19 cd ..
@@ -0,0 +1,5 b''
1 merging a and b to b
2 warning: conflicts during merge.
3 merging b failed!
4 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
5 use 'hg resolve' to retry unresolved file merges
@@ -117,8 +117,23 b' def copies(repo, c1, c2, ca, checkdirs=F'
117 diverge = {}
117 diverge = {}
118
118
119 def related(f1, f2, limit):
119 def related(f1, f2, limit):
120 # Walk back to common ancestor to see if the two files originate
121 # from the same file. Since workingfilectx's rev() is None it messes
122 # up the integer comparison logic, hence the pre-step check for
123 # None (f1 and f2 can only be workingfilectx's initially).
124
125 if f1 == f2:
126 return f1 # a match
127
120 g1, g2 = f1.ancestors(), f2.ancestors()
128 g1, g2 = f1.ancestors(), f2.ancestors()
121 try:
129 try:
130 f1r, f2r = f1.rev(), f2.rev()
131
132 if f1r is None:
133 f1 = g1.next()
134 if f2r is None:
135 f2 = g2.next()
136
122 while 1:
137 while 1:
123 f1r, f2r = f1.rev(), f2.rev()
138 f1r, f2r = f1.rev(), f2.rev()
124 if f1r > f2r:
139 if f1r > f2r:
@@ -1500,8 +1500,13 b' class localrepository(repo.repository):'
1500 remote_heads = remote.heads()
1500 remote_heads = remote.heads()
1501 inc = self.findincoming(remote, common, remote_heads, force=force)
1501 inc = self.findincoming(remote, common, remote_heads, force=force)
1502
1502
1503 cl = self.changelog
1503 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1504 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1504 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1505 msng_cl, bases, heads = cl.nodesbetween(update, revs)
1506
1507 outgoingnodeset = set(msng_cl)
1508 # compute set of nodes which, if they were a head before, no longer are
1509 nolongeraheadnodeset = set(p for n in msng_cl for p in cl.parents(n))
1505
1510
1506 def checkbranch(lheads, rheads, branchname=None):
1511 def checkbranch(lheads, rheads, branchname=None):
1507 '''
1512 '''
@@ -1511,26 +1516,10 b' class localrepository(repo.repository):'
1511 lheads: local branch heads
1516 lheads: local branch heads
1512 rheads: remote branch heads
1517 rheads: remote branch heads
1513 '''
1518 '''
1514
1519 newlheads = [n for n in lheads if n in outgoingnodeset]
1515 warn = 0
1520 formerrheads = [n for n in rheads if n in nolongeraheadnodeset]
1516
1521 if len(newlheads) > len(formerrheads):
1517 if len(lheads) > len(rheads):
1522 # we add more new heads than we demote former heads to non-head
1518 warn = 1
1519 else:
1520 # add heads we don't have or that are not involved in the push
1521 newheads = set(lheads)
1522 for r in rheads:
1523 if r in self.changelog.nodemap:
1524 desc = self.changelog.heads(r, heads)
1525 l = [h for h in heads if h in desc]
1526 if not l:
1527 newheads.add(r)
1528 else:
1529 newheads.add(r)
1530 if len(newheads) > len(rheads):
1531 warn = 1
1532
1533 if warn:
1534 if branchname is not None:
1523 if branchname is not None:
1535 msg = _("abort: push creates new remote heads"
1524 msg = _("abort: push creates new remote heads"
1536 " on branch '%s'!\n") % branchname
1525 " on branch '%s'!\n") % branchname
@@ -1594,7 +1583,7 b' class localrepository(repo.repository):'
1594
1583
1595 if revs is None:
1584 if revs is None:
1596 # use the fast path, no race possible on push
1585 # use the fast path, no race possible on push
1597 nodes = self.changelog.findmissing(common.keys())
1586 nodes = cl.findmissing(common.keys())
1598 cg = self._changegroup(nodes, 'push')
1587 cg = self._changegroup(nodes, 'push')
1599 else:
1588 else:
1600 cg = self.changegroupsubset(update, revs, 'push')
1589 cg = self.changegroupsubset(update, revs, 'push')
@@ -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