##// END OF EJS Templates
discovery: convert legacy part of checkheads to revs from nodes...
Joshua Redstone -
r17011:25f7d40f default
parent child Browse files
Show More
@@ -207,19 +207,18 b' def checkheads(repo, remote, outgoing, r'
207 # 1-4b. old servers: Check for new topological heads.
207 # 1-4b. old servers: Check for new topological heads.
208 # Construct {old,new}map with branch = None (topological branch).
208 # Construct {old,new}map with branch = None (topological branch).
209 # (code based on _updatebranchcache)
209 # (code based on _updatebranchcache)
210 oldheads = set(h for h in remoteheads if h in cl.nodemap)
210 oldheadrevs = set(cl.rev(h) for h in remoteheads if h in cl.nodemap)
211 newheads = oldheads.union(outgoing.missing)
211 missingrevs = [cl.rev(node) for node in outgoing.missing]
212 if len(newheads) > 1:
212 newheadrevs = oldheadrevs.union(missingrevs)
213 for latest in reversed(outgoing.missing):
213 if len(newheadrevs) > 1:
214 if latest not in newheads:
214 for latest in sorted(missingrevs, reverse=True):
215 if latest not in newheadrevs:
215 continue
216 continue
216 minhrev = min(cl.rev(h) for h in newheads)
217 reachable = cl.ancestors([latest], min(newheadrevs))
217 reachable = [cl.node(rev) for rev in
218 newheadrevs.difference_update(reachable)
218 cl.ancestors([cl.rev(latest)], minhrev)]
219 newheads.difference_update(reachable)
220 branches = set([None])
219 branches = set([None])
221 newmap = {None: newheads}
220 newmap = {None: [cl.node(rev) for rev in newheadrevs]}
222 oldmap = {None: oldheads}
221 oldmap = {None: [cl.node(rev) for rev in oldheadrevs]}
223 unsynced = inc and branches or set()
222 unsynced = inc and branches or set()
224
223
225 # 5. Check for new heads.
224 # 5. Check for new heads.
@@ -15,6 +15,13 b' Tests discovery against servers without '
15 $ cp $HGRCPATH $HGRCPATH-nocap
15 $ cp $HGRCPATH $HGRCPATH-nocap
16 $ cp $HGRCPATH-withcap $HGRCPATH
16 $ cp $HGRCPATH-withcap $HGRCPATH
17
17
18 Prep for test server without branchmap support
19
20 $ CAP="branchmap"
21 $ . "$TESTDIR/notcapable"
22 $ cp $HGRCPATH $HGRCPATH-nocap-branchmap
23 $ cp $HGRCPATH-withcap $HGRCPATH
24
18 Setup HTTP server control:
25 Setup HTTP server control:
19
26
20 $ remote=http://localhost:$HGPORT/
27 $ remote=http://localhost:$HGPORT/
@@ -314,3 +321,51 b' Partial pull:'
314
321
315 $ tstop
322 $ tstop
316
323
324 Exercise pushing to server without branchmap capability
325
326 $ cp $HGRCPATH-nocap-branchmap $HGRCPATH-nocap
327 $ hg init rlocal
328 $ cd rlocal
329 $ echo A > A
330 $ hg ci -Am A
331 adding A
332 $ cd ..
333 $ hg clone rlocal rremote
334 updating to branch default
335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 $ cd rlocal
337 $ echo B > B
338 $ hg ci -Am B
339 adding B
340 $ cd ..
341 $ tstart rremote
342
343 $ cd rlocal
344 $ hg incoming $remote
345 comparing with http://localhost:$HGPORT/
346 searching for changes
347 no changes found
348 [1]
349 $ hg outgoing $remote
350 comparing with http://localhost:$HGPORT/
351 searching for changes
352 1 27547f69f254: B
353 $ hg pull $remote
354 pulling from http://localhost:$HGPORT/
355 searching for changes
356 no changes found
357 $ hg push $remote
358 pushing to http://localhost:$HGPORT/
359 searching for changes
360 remote: adding changesets
361 remote: adding manifests
362 remote: adding file changes
363 remote: added 1 changesets with 1 changes to 1 files
364 $ hg outgoing $remote
365 comparing with http://localhost:$HGPORT/
366 searching for changes
367 no changes found
368 [1]
369 $ cd ..
370
371 $ tstop
General Comments 0
You need to be logged in to leave comments. Login now