]> thyrsus.com Git - src.git/commitdiff
Removed src add.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 04:22:42 +0000 (23:22 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 12 Nov 2014 04:22:42 +0000 (23:22 -0500)
NEWS
src
src.asc
srctest

diff --git a/NEWS b/NEWS
index 207b4a2b0728dbf9493f0596ef6ba59d5e22a032..30bf50ee8d0aea1640750c50d4ce8e26eebf9b77 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 
 Repository head:
    Added src version.
+   Removed src add.  The first src commit to a file adds it.
    'U' (unmodified) becomes '.' in src status listings.
    src fast-export was broken in 0.4, it's fixed now.
 
diff --git a/src b/src
index f2003d38f1ff0c23fa17baa4d9c437aa77fba193..06e389f1ef5097bc73d349067d837caf07224878 100755 (executable)
--- a/src
+++ b/src
@@ -255,12 +255,9 @@ if it looks like a subcommand or revision number.
 src help [command]
    Displays help for commands.
 
-src add ['file'...]
-   Initialize new project histories for specified files. Creates
-   the repository directory if required.
-
 src commit [- | -m 'string' | -f 'file' | -e] ['file'...]
    Enters a commit for specified files. Separately to each one.
+   A history is created for the file if it does not aleady exist.
    With '-', take comment text from stdin; with '-m' use the
    following string as the comment; with '-f' take from a file.
    With '-e', edit even after '-f' or '-m'.   ci is a synonym for commit.
@@ -275,7 +272,7 @@ src checkout ['revision'] ['file'...]
 
 src status ['file'...]
    A = added, . = unmodified, M = modified, ! = missing, ? = not tracked,
-   I = ignored, L = locked (recover with src checkout).  The L
+   I = ignored, L = locked (recover with src checkout).  The A and L statuses
    status should only occur if you have used RCS directly on a file.
 
 src cat ['revision'] ['file'...]
@@ -427,24 +424,6 @@ class CommandContext:
         if self.end > len(metadata):
             croak("{0} has no {1} revision".format(metadata.name, self.end))
 
-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)
-    ctx = CommandContext("add", args, require_empty=True)
-    for arg in ctx.args:
-       if not os.path.exists(arg):
-           croak("I see no '%s' here." % arg)
-       elif os.path.exists(backend.master(arg)):
-           croak("%s is already registered." % arg)
-       else:
-           backend.add(arg)
-           if not quiet and len(ctx.args) > 1:
-              announce("%s -> 0" % arg)
-
 class CommentContext:
     def __init__(self, legend, args):
         "Attempt to collect a comment from command line args."
@@ -501,14 +480,19 @@ def commit_method(*args):
     for arg in ctx.args:
        if not os.path.exists(arg):
            croak("I see no '%s' here." % arg)
-       elif not os.path.exists(backend.master(arg)):
-           croak("%s is not registered." % arg)
     comment.edit()
     for arg in ctx.args:
-        with backend.lifter(arg):
-            backend.checkin(arg, comment.content())
-        if not quiet and len(args) > 1:
-            announce("%s -> %d" % (arg, len(History(arg))))
+        if not os.path.exists(backend.master(arg)):
+            if not os.path.exists(repodir):
+                try:
+                    os.mkdir(repodir)
+                except OSError:
+                    croak(" %s creation failed, check directory permissions." % repodir)
+            backend.add(arg)
+            with backend.lifter(arg):
+                backend.checkin(arg, comment.content())
+            if not quiet and len(args) > 1:
+                announce("%s -> %d" % (arg, len(History(arg))))
 
 def amend_method(*args):
     "Amend comments in stored revisions."
@@ -633,7 +617,7 @@ def status_method(*args):
             pairs.append((fn, "."))
     if not args:
         for m in registered:
-            if m not in candidates:
+            if backend.workfile(m) not in candidates:
                 pairs.append((m, "!"))
     pairs.sort()
     for (fn, status) in pairs:
@@ -903,7 +887,6 @@ def version_method(*args):
 
 dispatch = {
     "help":        help_method,
-    "add":         add_method,
     "commit":      commit_method,
     "ci":          commit_method,
     "amend":       amend_method,
diff --git a/src.asc b/src.asc
index 15462ee64323a8cbabb5b10b91b4786793ba74c8..5f962a996c9d66c3444cf66ceef6e05a50211293 100644 (file)
--- a/src.asc
+++ b/src.asc
@@ -44,12 +44,9 @@ if it looks like a subcommand or revision number.
 src help [command]::
    Displays help for commands.
 
-src add ['file'...]::
-   Initialize new project histories for specified files. Creates
-   the repository directory if required.
-
 src commit [- | -m string | -f file | -e] ['file'...]::
    Enters a commit for specified files. Separately to each one.
+   A history is created for the file if it does not aleady exist.
    With '-', take comment text from stdin; with '-m' use the
    following string as the comment; with '-f' take from a file.
    With '-e', edit even after '-f' or '-m'. ci is a synonym for commit.
@@ -64,8 +61,8 @@ src checkout [revision] ['file'...]::
 
 src status ['file'...]::
    A = added, . = unmodified, M = modified, ! = missing, ? = not tracked,
-   I = ignored, L = locked (recover with src checkout).  The L
-   status should only occur if you have used RCS directly on a file.
+   I = ignored, L = locked (recover with src checkout).  The A and L
+   statuses should only occur if you have used RCS directly on a file.
 
 src cat [revision-range] ['file'...]::
    Send the specified revisions of the files to standard output.
diff --git a/srctest b/srctest
index e0e943edb5aa26acf25d6b2f0326b800cd041bcb..9f4e19b9ed77cace8ae6b8c9863bc0ff40f5b8f7 100755 (executable)
--- a/srctest
+++ b/srctest
@@ -30,9 +30,6 @@ Now is the time
 EOF
 cp testfile1 testrev1
 
-src $TESTOPTS add testfile1 >/dev/null
-check "add"
-
 src $TESTOPTS commit -m "First comment" testfile1 >/dev/null
 check "commit with -m option"