--- a/mercurial/branchmap.py Wed Dec 19 14:43:33 2012 +0100
+++ b/mercurial/branchmap.py Thu Dec 20 13:37:37 2012 +0100
@@ -4,3 +4,17 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+
+from node import hex
+import encoding
+
+def write(repo, branches, tip, tiprev):
+ try:
+ f = repo.opener("cache/branchheads", "w", atomictemp=True)
+ f.write("%s %s\n" % (hex(tip), tiprev))
+ for label, nodes in branches.iteritems():
+ for node in nodes:
+ f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
+ f.close()
+ except (IOError, OSError):
+ pass