Mercurial > public > mercurial-scm > hg
view mercurial/branchmap.py @ 18117:526e7ec5c96e
branchmap: extract write logic from localrepo
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 20 Dec 2012 13:37:37 +0100 |
parents | bcee63733aad |
children | e70ff1e599f4 |
line wrap: on
line source
# branchmap.py - logic to computes, maintain and stores branchmap for local repo # # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> # # 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