From d1421f7e3e6f565185d9fa69d9ff7f6c54bed1a5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 11 Nov 2014 23:22:42 -0500 Subject: [PATCH] Removed src add. --- NEWS | 1 + src | 45 ++++++++++++++------------------------------- src.asc | 9 +++------ srctest | 3 --- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/NEWS b/NEWS index 207b4a2..30bf50e 100644 --- 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 f2003d3..06e389f 100755 --- 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 15462ee..5f962a9 100644 --- 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 e0e943e..9f4e19b 100755 --- 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" -- 2.43.0