src help [command]
Displays help for commands.
-src init::
- Creates a repo directory if none already exists
-
src add ['file'...]
Initialize new project histories for specified files.
The omission of 'src remove' is a deliberate speed bump.
"""
-def init_method(*args):
- "Create a repo directory if none already exists."
- if args:
- target = os.path.join(args[0], ".src")
- else:
- target = repodir
- if not os.path.exists(target):
- try:
- os.mkdir(target)
- except OSError:
- croak("creation failed, check directory permissions.")
- elif os.path.isdir(target):
- croak("%s already exists." % target)
- else:
- croak("%s exists but is not a directory." % target)
-
def preamble(cmd, args):
"Common setup code."
if not os.path.exists(repodir):
def add_method(*args):
"Register a file into src control."
+ if not os.path.exists(repodir):
+ try:
+ os.mkdir(repodir)
+ except OSError:
+ croak(" %s creation failed, check directory permissions." % repodir)
(revspec, args) = preamble("add", args)
if revspec is not None:
croak("add doesn't take a revision spec")
dispatch = {
"help": help_method,
- "init": init_method,
"add": add_method,
"commit": commit_method,
"ci": commit_method,
src help [command]::
Displays help for commands.
-src init::
- Creates a .src directory if none already exists
-
src add ['file'...]
Initialize new project histories for specified files.
umask 0077
# Needs to not be a subdirectory of here, or git gets confused. Use
-# -u so that `src init` will work.
+# -u so that `initialization will work.
SANDBOX=$(mktemp -u /tmp/.src_XXXXXXXX)
# Set the PATH to include the current directory, so the repository
TESTOPTS="-T -S $SANDBOX $*"
-# Catches dumb and obvious case of code having a Python syntax error
-src $TESTOPTS init
-check "init"
-
-src $TESTOPTS >>/dev/null 2>&1
-check "smoke test"
-
cat >testfile1 <<EOF
Now is the time
EOF