From: Eric S. Raymond Date: Fri, 19 Dec 2014 21:12:32 +0000 (-0500) Subject: Version bump for release 0.17. X-Git-Tag: 0.17^0 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=7b990a5591573ce96e4d5d990b0eea1a74f7e274;p=src.git Version bump for release 0.17. --- diff --git a/NEWS b/NEWS index e741747..d1254fb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ src project news +0.17: 2014-12-19 + Undocumented 'add' command abolished; Emacs VC will use 'commit -a' instead. + 0.16: 2014-12-18 Allow -- as an argument ender in src diff. Changes to a workfile's x bits are propagated to its master on checkin. diff --git a/src b/src index 21454fc..ab2f72b 100755 --- a/src +++ b/src @@ -51,7 +51,7 @@ import sys, os, subprocess, time, calendar, stat, glob, shutil, hashlib -version="0.16" +version="0.17" def rfc3339(t): "RFC3339 string from Unix time." @@ -339,6 +339,7 @@ class History: return self.by_revno_d[revno] except KeyError: if revno == 0: + raise ValueError # This case comes up if we try to select the # tip revision of a history without revisions. croak("{0} has no revisions".format(self.name)) @@ -453,12 +454,6 @@ src amend [- | -m string | -f file | -e] ['revision'] ['file'...] Amends the stored comment for a specified revision, defaulting to the latest revision on the current branch. Flags are as for commit. -src add ['file'...] - Initialize new project histories for specified files. Creates - the repository directory if required. This command is not intended - for human use - commit adds files when necessary. It's a helper - for Emacs VC mode. - src checkout ['revision'] ['file'...] Refresh the working copies of the file(s) from their history files. 'co' is a synonym for checkout. @@ -1069,33 +1064,47 @@ def commit_method(*args): except OSError: croak(" %s creation failed, check directory permissions." % repodir) args = list(args) - comment = CommentContext("commit", args) + addonly = False + while args: + if args[0] == '--': + args.pop(0) + break + elif args[0] == '-a': + addonly = True + args.pop(0) + else: + break + if not addonly: + comment = CommentContext("commit", args) ctx = CommandContext("commit", args, require_empty=True, - parse_revspec=comment.parse_revspec) + parse_revspec=not addonly and comment.parse_revspec) for arg in ctx.args: if not os.path.exists(arg): croak("I see no '%s' here." % arg) if os.path.isdir(arg): croak("cannot commit directory '%s'" % arg) for arg in ctx.args: - if registered(arg): + if not registered(arg): + trailer = "Committing initial revision of {0}".format(arg) + revcount = 0 + elif addonly: + croak("attempt to re-add a registeed file failed") + else: metadata = History(arg) ctx.resolve(metadata) - if ctx.is_empty(): + if len(metadata) and ctx.is_empty(): ctx.select_tip(metadata) trailer = "Committing {0} revision {1}.\n".format(arg, ctx.start) revcount = len(metadata) - else: - trailer = "Committing initial revision of {0}".format(arg) - revcount = 0 - if not comment.edit(content="", trailer=trailer): + if not addonly and not comment.edit(content="", trailer=trailer): announce("in %s, commit cancelled" % arg) else: if not registered(arg): backend.add(arg) - with backend.lifter(arg): - backend.checkin(arg, comment.content()) + if not addonly: + with backend.lifter(arg): + backend.checkin(arg, comment.content()) make_stamp(arg) if not quiet and len(args) > 1: announce("%s -> %d" % (arg, revcount)) @@ -1130,27 +1139,6 @@ def amend_method(*args): if not quiet and len(args) > 1: announce("%s : %d" % (arg, ctx.start)) -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.history(arg)): - croak("%s is already registered." % arg) - elif os.path.isdir(arg): - croak("cannot commit directory '%s'" % arg) - for arg in ctx.args: - if not os.path.exists(backend.history(arg)): - backend.add(arg) - if not quiet and len(ctx.args) > 1: - announce("%s -> 0" % arg) - def list_method(*args): "Generate a summary listing of commits, one line per commit." args = list(args) @@ -1616,7 +1604,6 @@ dispatch = { "ci": commit_method, "amend": amend_method, "am": amend_method, - "add": add_method, "list": list_method, "li": list_method, "log": log_method,