Extract .redo dir state management stuff into its own file.

In preparation for changing the on-disk format eventually, as well as making
the main code more readable.
This commit is contained in:
Avery Pennarun 2010-11-19 03:03:05 -08:00
commit dc3efb69cc
5 changed files with 158 additions and 97 deletions

View file

@ -81,17 +81,3 @@ def relpath(t, base):
return '/'.join(tparts)
def sname(typ, t, fromdir=None):
# FIXME: t.replace(...) is non-reversible and non-unique here!
if fromdir:
t = os.path.join(fromdir, t)
tnew = relpath(t, vars.BASE)
v = vars.BASE + ('/.redo/%s^%s' % (typ, tnew.replace('/', '^')))
debug2('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew))
return v
def add_dep(t, mode, dep):
debug2('add-dep(%r)\n' % t)
open(sname('dep', t), 'a').write('%s %s\n'
% (mode, relpath(dep, vars.BASE)))