Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGd36a7da96a5a: discovery: drop some unused sets
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/discovery.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | Mar 17 2019, 11:34 AM |
headssum = {} | headssum = {} | ||||
missingctx = set() | missingctx = set() | ||||
# A. Create set of branches involved in the push. | # A. Create set of branches involved in the push. | ||||
branches = set() | branches = set() | ||||
for n in outgoing.missing: | for n in outgoing.missing: | ||||
ctx = repo[n] | ctx = repo[n] | ||||
missingctx.add(ctx) | missingctx.add(ctx) | ||||
branches.add(ctx.branch()) | branches.add(ctx.branch()) | ||||
nbranches = branches.copy() | |||||
with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
remotemap = e.callcommand('branchmap', {}).result() | remotemap = e.callcommand('branchmap', {}).result() | ||||
remotebranches = set(remotemap) | remotebranches = set(remotemap) | ||||
newbranches = branches - remotebranches | |||||
branches.difference_update(newbranches) | |||||
# A. register remote heads | # A. register remote heads | ||||
for branch, heads in remotemap.iteritems(): | for branch, heads in remotemap.iteritems(): | ||||
known = [] | known = [] | ||||
unsynced = [] | unsynced = [] | ||||
knownnode = cl.hasnode # do not use nodemap until it is filtered | knownnode = cl.hasnode # do not use nodemap until it is filtered | ||||
for h in heads: | for h in heads: | ||||
if knownnode(h): | if knownnode(h): | ||||
known.append(h) | known.append(h) | ||||
else: | else: | ||||
unsynced.append(h) | unsynced.append(h) | ||||
headssum[branch] = (known, list(known), unsynced) | headssum[branch] = (known, list(known), unsynced) | ||||
# B. add new branch data | # B. add new branch data | ||||
for branch in nbranches: | for branch in branches: | ||||
if branch not in headssum: | if branch not in headssum: | ||||
headssum[branch] = (None, [], []) | headssum[branch] = (None, [], []) | ||||
# C drop data about untouched branches: | # C drop data about untouched branches: | ||||
for branch in remotebranches - nbranches: | for branch in remotebranches - branches: | ||||
del headssum[branch] | del headssum[branch] | ||||
# D. Update newmap with outgoing changes. | # D. Update newmap with outgoing changes. | ||||
# This will possibly add new heads and remove existing ones. | # This will possibly add new heads and remove existing ones. | ||||
newmap = branchmap.remotebranchcache((branch, heads[1]) | newmap = branchmap.remotebranchcache((branch, heads[1]) | ||||
for branch, heads in headssum.iteritems() | for branch, heads in headssum.iteritems() | ||||
if heads[0] is not None) | if heads[0] is not None) | ||||
newmap.update(repo, (ctx.rev() for ctx in missingctx)) | newmap.update(repo, (ctx.rev() for ctx in missingctx)) |