# HG changeset patch # User Pierre-Yves David # Date 1357060764 -3600 # Node ID 8d48af68e2ae780950479e5a65cda5a4c0730a09 # Parent e1caaeb5a2edac2d5cb1b36c5d22f973329d4d4d branchmap: read and write key part related to filtered revision Now that we have a third part for the cache key we need to write and read it on disk. It is only written when there is filtered revision. This keep the format compatible with older version. Notes that, at this state, filtered repository does not use any disk caches yet. diff -r e1caaeb5a2ed -r 8d48af68e2ae mercurial/branchmap.py --- a/mercurial/branchmap.py Tue Jan 01 13:05:22 2013 -0600 +++ b/mercurial/branchmap.py Tue Jan 01 18:19:24 2013 +0100 @@ -18,9 +18,14 @@ return branchcache() try: - last, lrev = lines.pop(0).split(" ", 1) + cachekey = lines.pop(0).split(" ", 2) + last, lrev = cachekey[:2] last, lrev = bin(last), int(lrev) - partial = branchcache(tipnode=last, tiprev=lrev) + filteredhash = None + if len(cachekey) > 2: + filteredhash = bin(cachekey[2]) + partial = branchcache(tipnode=last, tiprev=lrev, + filteredhash=filteredhash) if not partial.validfor(repo): # invalidate the cache raise ValueError('tip differs') @@ -113,7 +118,10 @@ def write(self, repo): try: f = repo.opener("cache/branchheads", "w", atomictemp=True) - f.write("%s %s\n" % (hex(self.tipnode), self.tiprev)) + cachekey = [hex(self.tipnode), str(self.tiprev)] + if self.filteredhash is not None: + cachekey.append(hex(self.filteredhash)) + f.write(" ".join(cachekey) + '\n') for label, nodes in self.iteritems(): for node in nodes: f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))