[PATCH 01 of 13 V2] branchmap: add documentation on the branchcache on-disk format

Brodie Rao brodie at sf.io
Fri Nov 15 22:18:45 CST 2013


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1384575488 18000
#      Fri Nov 15 23:18:08 2013 -0500
# Node ID 9e587b8b595f736e37a0a56ee3e3404d734e25ee
# Parent  c38c3fdc8b9317ba09e03ab09364c3800da7c50c
branchmap: add documentation on the branchcache on-disk format

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -83,7 +83,22 @@ def updatecache(repo):
     repo._branchcaches[repo.filtername] = partial
 
 class branchcache(dict):
-    """A dict like object that hold branches heads cache"""
+    """A dict like object that hold branches heads cache.
+
+    This cache is used to avoid costly computations to determine all the
+    branch heads of a repo.
+
+    The cache is serialized on disk in the following format:
+
+    <tip hex node> <tip rev number> [optional filtered repo hex hash]
+    <branch head hex node> <branch name>
+    <branch head hex node> <branch name>
+    ...
+
+    The first line is used to check if the cache is still valid. If the
+    branch cache is for a filtered repo view, an optional third hash is
+    included that hashes the hashes of all filtered revisions.
+    """
 
     def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
                  filteredhash=None):


More information about the Mercurial-devel mailing list