Mercurial > hg
changeset 17011:25f7d40fe735
discovery: convert legacy part of checkheads to revs from nodes
After a recent switch from revlog.reachable to revlog.ancestors,
clean up this old call site, switching it from nodes to revs.
author | Joshua Redstone <joshua.redstone@fb.com> |
---|---|
date | Fri, 08 Jun 2012 14:23:31 -0700 |
parents | a6c64211acdb |
children | ea97744c4801 |
files | mercurial/discovery.py tests/test-treediscovery-legacy.t |
diffstat | 2 files changed, 65 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/discovery.py Fri Jun 08 14:21:32 2012 -0700 +++ b/mercurial/discovery.py Fri Jun 08 14:23:31 2012 -0700 @@ -207,19 +207,18 @@ # 1-4b. old servers: Check for new topological heads. # Construct {old,new}map with branch = None (topological branch). # (code based on _updatebranchcache) - oldheads = set(h for h in remoteheads if h in cl.nodemap) - newheads = oldheads.union(outgoing.missing) - if len(newheads) > 1: - for latest in reversed(outgoing.missing): - if latest not in newheads: + oldheadrevs = set(cl.rev(h) for h in remoteheads if h in cl.nodemap) + missingrevs = [cl.rev(node) for node in outgoing.missing] + newheadrevs = oldheadrevs.union(missingrevs) + if len(newheadrevs) > 1: + for latest in sorted(missingrevs, reverse=True): + if latest not in newheadrevs: continue - minhrev = min(cl.rev(h) for h in newheads) - reachable = [cl.node(rev) for rev in - cl.ancestors([cl.rev(latest)], minhrev)] - newheads.difference_update(reachable) + reachable = cl.ancestors([latest], min(newheadrevs)) + newheadrevs.difference_update(reachable) branches = set([None]) - newmap = {None: newheads} - oldmap = {None: oldheads} + newmap = {None: [cl.node(rev) for rev in newheadrevs]} + oldmap = {None: [cl.node(rev) for rev in oldheadrevs]} unsynced = inc and branches or set() # 5. Check for new heads.
--- a/tests/test-treediscovery-legacy.t Fri Jun 08 14:21:32 2012 -0700 +++ b/tests/test-treediscovery-legacy.t Fri Jun 08 14:23:31 2012 -0700 @@ -15,6 +15,13 @@ $ cp $HGRCPATH $HGRCPATH-nocap $ cp $HGRCPATH-withcap $HGRCPATH +Prep for test server without branchmap support + + $ CAP="branchmap" + $ . "$TESTDIR/notcapable" + $ cp $HGRCPATH $HGRCPATH-nocap-branchmap + $ cp $HGRCPATH-withcap $HGRCPATH + Setup HTTP server control: $ remote=http://localhost:$HGPORT/ @@ -314,3 +321,51 @@ $ tstop +Exercise pushing to server without branchmap capability + + $ cp $HGRCPATH-nocap-branchmap $HGRCPATH-nocap + $ hg init rlocal + $ cd rlocal + $ echo A > A + $ hg ci -Am A + adding A + $ cd .. + $ hg clone rlocal rremote + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd rlocal + $ echo B > B + $ hg ci -Am B + adding B + $ cd .. + $ tstart rremote + + $ cd rlocal + $ hg incoming $remote + comparing with http://localhost:$HGPORT/ + searching for changes + no changes found + [1] + $ hg outgoing $remote + comparing with http://localhost:$HGPORT/ + searching for changes + 1 27547f69f254: B + $ hg pull $remote + pulling from http://localhost:$HGPORT/ + searching for changes + no changes found + $ hg push $remote + pushing to http://localhost:$HGPORT/ + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + $ hg outgoing $remote + comparing with http://localhost:$HGPORT/ + searching for changes + no changes found + [1] + $ cd .. + + $ tstop