]> thyrsus.com Git - src.git/commitdiff
Remove init from the command set, it's now done on add.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 04:45:39 +0000 (23:45 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 04:45:39 +0000 (23:45 -0500)
src
src.asc
srctest

diff --git a/src b/src
index 1c5c8d23adb83fba3d7c386d954a8d7795ba63b5..4a9ca86b8114b755a40976ecab30aff0ad62e4dd 100755 (executable)
--- 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 1070db69513d9c24b9dd817143143ace4544704d..b86e7810fd432fa7c1e2b87a335bd8da27cd7bf4 100644 (file)
--- 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 b363ea0d794ee1a3124865fc70d1946ff4018faf..f7952f3f870d6cb67047b3be526689b251eb1ec4 100755 (executable)
--- 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 <<EOF
 Now is the time
 EOF