diff --git a/redo.py b/redo.py index 263e2fb..a8b6546 100755 --- a/redo.py +++ b/redo.py @@ -1,5 +1,5 @@ #!/usr/bin/python -import sys, os, glob +import sys, os import options, jwack, atoi optspec = """ @@ -38,20 +38,12 @@ if not os.environ.get('REDO_BASE', ''): os.environ['REDO'] = os.path.abspath(sys.argv[0]) -import vars, builder -from helpers import * +import vars, state, builder +from helpers import err if is_root: - # FIXME: just wiping out all the locks is kind of cheating. But we - # only do this from the toplevel redo process, so unless the user - # deliberately starts more than one redo on the same repository, it's - # sort of ok. - mkdirp('%s/.redo' % base) - for f in glob.glob('%s/.redo/lock*' % base): - os.unlink(f) - for f in glob.glob('%s/.redo/mark^*' % base): - os.unlink(f) + state.init() if not vars.DEPTH: diff --git a/state.py b/state.py index 3f8591d..4b3a580 100644 --- a/state.py +++ b/state.py @@ -1,6 +1,18 @@ -import sys, os, errno +import sys, os, errno, glob import vars -from helpers import unlink, relpath, debug2 +from helpers import unlink, relpath, debug2, mkdirp + + +def init(): + # FIXME: just wiping out all the locks is kind of cheating. But we + # only do this from the toplevel redo process, so unless the user + # deliberately starts more than one redo on the same repository, it's + # sort of ok. + mkdirp('%s/.redo' % vars.BASE) + for f in glob.glob('%s/.redo/lock*' % vars.BASE): + os.unlink(f) + for f in glob.glob('%s/.redo/mark^*' % vars.BASE): + os.unlink(f) def _sname(typ, t, fromdir=None):