mercurial/branchmap.py
changeset 18127 dcd43ac7572d
parent 18126 090ada0acddb
child 18128 f0d56efaa35a
equal deleted inserted replaced
18126:090ada0acddb 18127:dcd43ac7572d
    40         if repo.ui.debugflag:
    40         if repo.ui.debugflag:
    41             repo.ui.warn(str(inst), '\n')
    41             repo.ui.warn(str(inst), '\n')
    42         partial = branchcache()
    42         partial = branchcache()
    43     return partial
    43     return partial
    44 
    44 
    45 def write(repo, branches, tip, tiprev):
    45 def write(repo, cache):
    46     try:
    46     try:
    47         f = repo.opener("cache/branchheads", "w", atomictemp=True)
    47         f = repo.opener("cache/branchheads", "w", atomictemp=True)
    48         f.write("%s %s\n" % (hex(tip), tiprev))
    48         f.write("%s %s\n" % (hex(cache.tipnode), cache.tiprev))
    49         for label, nodes in branches.iteritems():
    49         for label, nodes in cache.iteritems():
    50             for node in nodes:
    50             for node in nodes:
    51                 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
    51                 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
    52         f.close()
    52         f.close()
    53     except (IOError, OSError):
    53     except (IOError, OSError):
    54         pass
    54         pass
   131     if partial.tiprev < catip:
   131     if partial.tiprev < catip:
   132         ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip))
   132         ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip))
   133         update(repo, partial, ctxgen)
   133         update(repo, partial, ctxgen)
   134         partial.tipnode = cl.node(catip)
   134         partial.tipnode = cl.node(catip)
   135         partial.tiprev = catip
   135         partial.tiprev = catip
   136         write(repo, partial, partial.tipnode, partial.tiprev)
   136         write(repo, partial)
   137     # If cacheable tip were lower than actual tip, we need to update the
   137     # If cacheable tip were lower than actual tip, we need to update the
   138     # cache up to tip. This update (from cacheable to actual tip) is not
   138     # cache up to tip. This update (from cacheable to actual tip) is not
   139     # written to disk since it's not cacheable.
   139     # written to disk since it's not cacheable.
   140     tiprev = len(repo) - 1
   140     tiprev = len(repo) - 1
   141     if partial.tiprev < tiprev:
   141     if partial.tiprev < tiprev: