Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
18116:bcee63733aad | 18117:526e7ec5c96e |
---|---|
2 # | 2 # |
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | |
8 from node import hex | |
9 import encoding | |
10 | |
11 def write(repo, branches, tip, tiprev): | |
12 try: | |
13 f = repo.opener("cache/branchheads", "w", atomictemp=True) | |
14 f.write("%s %s\n" % (hex(tip), tiprev)) | |
15 for label, nodes in branches.iteritems(): | |
16 for node in nodes: | |
17 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) | |
18 f.close() | |
19 except (IOError, OSError): | |
20 pass |