mercurial/branchmap.py
changeset 18305 2502a15e033d
parent 18234 a55b06885cda
child 18307 0eed2546118a
equal deleted inserted replaced
18304:9b6ae29d4801 18305:2502a15e033d
    75                 partial = subset.branchmap().copy()
    75                 partial = subset.branchmap().copy()
    76                 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
    76                 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
    77                 revs.extend(r for  r in extrarevs if r <= partial.tiprev)
    77                 revs.extend(r for  r in extrarevs if r <= partial.tiprev)
    78     revs.extend(cl.revs(start=partial.tiprev + 1))
    78     revs.extend(cl.revs(start=partial.tiprev + 1))
    79     if revs:
    79     if revs:
    80         ctxgen = (repo[r] for r in revs)
    80         partial.update(repo, revs)
    81         partial.update(repo, ctxgen)
       
    82         partial.write(repo)
    81         partial.write(repo)
    83     assert partial.validfor(repo)
    82     assert partial.validfor(repo)
    84     repo._branchcaches[repo.filtername] = partial
    83     repo._branchcaches[repo.filtername] = partial
    85 
    84 
    86 class branchcache(dict):
    85 class branchcache(dict):
   142             f.close()
   141             f.close()
   143         except (IOError, OSError, util.Abort):
   142         except (IOError, OSError, util.Abort):
   144             # Abort may be raise by read only opener
   143             # Abort may be raise by read only opener
   145             pass
   144             pass
   146 
   145 
   147     def update(self, repo, ctxgen):
   146     def update(self, repo, revgen):
   148         """Given a branchhead cache, self, that may have extra nodes or be
   147         """Given a branchhead cache, self, that may have extra nodes or be
   149         missing heads, and a generator of nodes that are at least a superset of
   148         missing heads, and a generator of nodes that are at least a superset of
   150         heads missing, this function updates self to be correct.
   149         heads missing, this function updates self to be correct.
   151         """
   150         """
   152         cl = repo.changelog
   151         cl = repo.changelog
       
   152         ctxgen = (repo[r] for r in revgen)
   153         # collect new branch entries
   153         # collect new branch entries
   154         newbranches = {}
   154         newbranches = {}
   155         for c in ctxgen:
   155         for c in ctxgen:
   156             newbranches.setdefault(c.branch(), []).append(c.node())
   156             newbranches.setdefault(c.branch(), []).append(c.node())
   157         # if older branchheads are reachable from new ones, they aren't
   157         # if older branchheads are reachable from new ones, they aren't