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

login
register
mail settings
Submitter Brodie Rao
Date Nov. 16, 2013, 4:18 a.m.
Message ID <9e587b8b595f736e37a0.1384575525@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2977/
State Accepted
Commit b9515fb9e72a0dcf9342ae4208564acc54b8d10a
Headers show

Comments

Brodie Rao - Nov. 16, 2013, 4:18 a.m.
# HG changeset patch
# User Brodie Rao <brodie@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

Patch

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):