# If true (option -T) use an artificial clock for regression testing
pseudotime = False
+# Repo directory
+repodir = ".src"
+
def do_or_die(dcmd, legend=b"", loud=False):
"Either execute a command or raise a fatal exception."
if legend:
self.name = name
self.revlist = []
self.symbols = {}
- with popen_or_die("cd .src >/dev/null; rlog %s; cd ..>/dev/null" % name) as fp:
+ with popen_or_die("cd %s >/dev/null; rlog %s; cd ..>/dev/null" % (repodir, name)) as fp:
self.revlist = []
self.lockrevs = []
maxrevno = 0
Displays help for commands.
src init::
- Creates a .src directory if none already exists
+ Creates a repo directory if none already exists
src add ['file'...]
Initialize new project histories for specified files.
"""
def init_method(*args):
- "Create a .src directory if none already exists."
- if not os.path.exists(".src"):
+ "Create a repo directory if none already exists."
+ if not os.path.exists(repodir):
try:
- os.mkdir(".src")
+ os.mkdir(repodir)
except OSError:
- complain(".src/ creation failed, check directory permissions.")
- elif os.path.isdir(".src"):
- complain(".src/ already exists.")
+ complain("creation failed, check directory permissions.")
+ elif os.path.isdir(repodir):
+ complain("%s already exists." % repodir)
else:
- complain(".src/ exists but is not a directory.")
+ complain("%s exists but is not a directory." % repodir)
def preamble(cmd, args):
"Common setup code."
croak("malformed revision spec: %s" % revspec)
revspec = (start, end)
if not args:
- masters = os.listdir(".src")
+ try:
+ masters = os.listdir(repodir)
+ except OSError:
+ croak("repo directory %s does not exist" % repodir)
if len(masters) == 1:
args += [master[:-2] for master in masters]
else:
for arg in args:
if not os.path.exists(arg):
complain("I see no '%s' here." % arg)
- elif os.path.exists(".src/%s,v" % arg):
+ elif os.path.exists("%s/%s,v" % (repodir, arg)):
complain("%s is already registered." % arg)
else:
- do_or_die("rcs -q -kb -i {0} </dev/null && mv {0},v .src".format(arg))
+ do_or_die("rcs -q -kb -i {0} </dev/null && mv {0},v {1}".format(arg, repodir))
announce("%s: 0" % arg)
class lifted:
def __init__(self, name):
self.name = name
def __enter__(self):
- do_or_die("mv .src/{0},v .".format(self.name))
+ do_or_die("mv {0}/{1},v .".format(repodir, self.name))
def __exit__(self, extype, value, traceback_unused):
- do_or_die("mv {0},v .src".format(self.name))
+ do_or_die("mv {0},v {1}".format(self.name, repodir))
if extype:
raise extype(value)
return True
croak("commit doesn't take a revision spec")
for arg in args:
if not os.path.exists(arg):
- complain("I see no '%s' here." % arg)
- elif not os.path.exists(".src/%s,v" % arg):
- complain("%s is not registered." % arg)
+ croak("I see no '%s' here." % arg)
+ elif not os.path.exists("%s/%s,v" % (repodir, arg)):
+ croak("%s is not registered." % arg)
else:
if not comment:
editor = os.getenv("EDITOR") or "emacsclient"
while command and command[0].startswith("-"):
if command[0] == '-d':
debug += 1
- if command[0] == '-T':
+ elif command[0] == '-T':
pseudotime = True
+ elif command[0] == '-S':
+ repodir = command[1]
+ command.pop(0)
command.pop(0)
if not command:
help_method()
If no files are specified, all eligible files are operated on in sequence.
+== DEBUGGING OPTIONS ==
+
+These will be of interet mainly to developers"
+
A '-d' option before the main command word turns on debugging
-messages; it can be repeated for higher debugging levels. A -T option
-sets up an artificial clock that ticks once on each revision and
-fixes the user information to be used in fast-export; it's for
-regression testing.
+messages; it can be repeated for higher debugging levels.
+
+A -S (sandbox) option can be used to set the repository directory
+to something other than its default of ".src".
+
+A -T option sets up an artificial clock that ticks once on each
+revision and fixes the user information to be used in fast-export;
+It also attributes all commits to J. Random Hacker and sets a
+constant screen witch of 79. It's for regression testing.
== DANGER! DANGER! ==
This is a proof-of-concept alpha release. The 'branch' and