From f663d267f80b06983932e94892bc678637e671cf Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 8 Nov 2014 23:45:39 -0500 Subject: [PATCH] Remove init from the command set, it's now done on add. --- src | 25 +++++-------------------- src.asc | 3 --- srctest | 9 +-------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src b/src index 1c5c8d2..4a9ca86 100755 --- a/src +++ b/src @@ -259,9 +259,6 @@ if it looks like a subcommand or revision number. 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. @@ -320,22 +317,6 @@ src fast-export ['file'...] 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): @@ -386,6 +367,11 @@ def preamble(cmd, args): 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") @@ -755,7 +741,6 @@ def ls_method(*args): dispatch = { "help": help_method, - "init": init_method, "add": add_method, "commit": commit_method, "ci": commit_method, diff --git a/src.asc b/src.asc index 1070db6..b86e781 100644 --- a/src.asc +++ b/src.asc @@ -43,9 +43,6 @@ if it looks like a subcommand or revision number. 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. diff --git a/srctest b/srctest index b363ea0..f7952f3 100755 --- a/srctest +++ b/srctest @@ -7,7 +7,7 @@ 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 @@ -25,13 +25,6 @@ check() { 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 <