From: Eric S. Raymond Date: Fri, 7 Nov 2014 15:28:57 +0000 (-0500) Subject: More commit options, so far untested. X-Git-Tag: 0.2~56 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=e371d70f623d20907385a47f710258a378b96f68;p=src.git More commit options, so far untested. --- diff --git a/NEWS b/NEWS index 2d453f6..47065cb 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,10 @@ ` src project news +Repository head: + There is a public repository on Gitorious + The bug that caused filures with vi has been fixed. + ".." is a legal range separator as well as "..". + More documentation. + 0.1: 2014-11-07 Initial proof-of-concept release. diff --git a/src b/src index 303e891..2bd61c8 100755 --- a/src +++ b/src @@ -243,27 +243,29 @@ src init:: src add ['file'...] Initialize new project histories for specified files. -src commit ['revison-spec'] ['file'...] +src commit [- | -m 'commentstring' | -f 'commentfile'] ['file'...] Enters a commit for specified files. Separately to each one. + With '-', take comment text from stdin; with '-m' use the + following string as the comment; with '-f' take from a file. ci is a synonym for commit. -src checkout [revspec] ['file'...] +src checkout [revision-spec] ['file'...] Refresh the working copy of the file(s) from their history files. co is a synonym for checkout. -src cat [revspec] ['file'...] +src cat [revision-spec] ['file'...] Send the specified revisions of the files to standard output. -src branch [delete] ['branchname'] +src branch [delete|del|-d] ['branchname'] Create, switch to, or delete a branch. With no arguments, list branches. -src tag [delete] ['tagname'] ['revspec'] ['file'...] +src tag [delete|del|-d] ['tagname'] ['revision-spec'] ['file'...] Create, switch to, or delete a tag. With no arguments, list tags. src list ['revision-spec'] ['file'...] Sends summary information about the specified commits to standard output. - In each file listing, the summary line tagged with '*' matches the - state of the working copy. + In each file listing, the summary line tagged with '*' is the + state that checkout would return to. src log ['revision-spec'] ['file'...] Sends log information about the specified commits to standard output. @@ -361,6 +363,25 @@ class lifted: def commit_method(*args): "Commit changes to files." + comment = None + if args[0] == '--': + args.pop(0) + elif args[0] == "-": + commentfp = sys.stdin.read() + args.pop(0) + elif args[0] == "-m": + try: + comment = args[1] + except IndexError: + croak("commit -m requires a following string.") + elif args[0] == "-f": + try: + comment = open(args[1]).read() + except IndexError: + croak("commit -f requires a following filename argument.") + except OSError: + croak("couldn't open %s." % args[1]) + args.pop(0) (revspec, args) = preamble("commit", args) if revspec is not None: croak("commit doesn't take a revision spec") @@ -370,13 +391,15 @@ def commit_method(*args): elif not os.path.exists(".src/%s,v" % arg): complain("%s is not registered." % arg) else: - editor = os.getenv("EDITOR") or "emacsclient" - scratchfile = "/tmp/src%dtmp" % os.getpid() - do_or_die(editor + " " + scratchfile, loud=True) - logcomment = open(scratchfile).read() - logcomment = "." + logcomment.replace("\n", "\n.")[:-1] + if not comment: + editor = os.getenv("EDITOR") or "emacsclient" + commentfile = "/tmp/src%dtmp" % os.getpid() + do_or_die(editor + " " + commentfile, loud=True) + comment = open(commentfile).read() + comment = "." + comment.replace("\n", "\n.")[:-1] + comment = comment.replace("'", r"\'") with lifted(arg): - do_or_die("ci -l -m'{1}' {0}".format(arg, logcomment)) + do_or_die("ci -l -m'{1}' {0}".format(arg, comment)) announce("%s -> %d" % (arg, len(RCSLog(arg)))) def list_method(*args): diff --git a/src.asc b/src.asc index a60e82a..73afc86 100644 --- a/src.asc +++ b/src.asc @@ -46,32 +46,41 @@ src init:: src add ['file'...] Initialize new project histories for specified files. -src commit ['file'...] +src commit [- | -m commentstring | -f commentfile] ['file'...] Enters a commit for specified files. Separately to each one. + With '-', take comment text from stdin; with '-m' use the + following string as the comment;with '-f' take from a file. + ci is a synonym for commit. -src checkout [revspec] ['file'...] +src checkout [revision-spec] ['file'...] Refresh the working copy of the file(s) from their history files. + co is a synonym for checkout. -src cat [revspec] ['file'...] +src cat [revision-spec] ['file'...] Send the specified revisions of the files to standard output. -src branch [delete] ['branchname'] +src branch [delete|del|-d] ['branchname'] Create, switch to, or delete a branch. With no arguments, list branches. -src tag [delete] ['tagname'] ['revspec'] ['file'...] +src tag [delete|del|-d] ['tagname'] ['revision-spec'] ['file'...] Create, switch to, or delete a tag. With no arguments, list tags. src list ['revision-spec'] ['file'...] Sends summary information about the specified commits to standard output. + In each file listing, the summary line tagged with '*' is the + state that checkout would return to. src log ['revision-spec'] ['file'...] Sends log information about the specified commits to standard output. src diff ['revision-spec'] ['file'...] - Sends a diff listing to standard output + Sends a diff listing to standard output. With no revision spec, diffs + the working copy against the last version checked in. With one revno, + diffs the working copy against that stored revision; with a range, src fast-export ['file'...] Export one or more projects as a git fast-import stream. + The committer identification is copied from your Git configuration. If no files are specified, all eligible files are operated on in sequence.