Mercurial > hg
view mercurial/phases.py @ 15447:9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Globbing is usually used for filenames, so on windows it is reasonable and very
convenient that glob patterns accepts '\' or '/' when the pattern specifies
'/'.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 07 Nov 2011 03:25:10 +0100 |
parents | ccb7de21625a |
children | 5a7dde5adec8 |
line wrap: on
line source
# Mercurial phases support code # # Copyright 2011 Pierre-Yves David <pierre-yves.david@ens-lyon.org> # Logilab SA <contact@logilab.fr> # Augie Fackler <durin42@gmail.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. import errno from node import nullid, bin, hex allphases = range(2) trackedphases = allphases[1:] def readroots(repo): """Read phase roots from disk""" roots = [set() for i in allphases] roots[0].add(nullid) try: f = repo.sopener('phaseroots') try: for line in f: phase, nh = line.strip().split() roots[int(phase)].add(bin(nh)) finally: f.close() except IOError, inst: if inst.errno != errno.ENOENT: raise return roots def writeroots(repo): """Write phase roots from disk""" f = repo.sopener('phaseroots', 'w', atomictemp=True) try: for phase, roots in enumerate(repo._phaseroots): for h in roots: f.write('%i %s\n' % (phase, hex(h))) finally: f.close()