]> thyrsus.com Git - src.git/commitdiff
More commit options, so far untested.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 7 Nov 2014 15:28:57 +0000 (10:28 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 7 Nov 2014 15:28:57 +0000 (10:28 -0500)
NEWS
src
src.asc

diff --git a/NEWS b/NEWS
index 2d453f655202cda0b5a25edadaa63253190a5586..47065cb11eb483f843b6cd15ae7b7aa51d2c4cc1 100644 (file)
--- 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 303e89190b30af515259a4199e1b5e48d6d49c2b..2bd61c83562b81a0cef6a760eaa82d2a1bdc693b 100755 (executable)
--- 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 a60e82ad94f2ed0382e0cc5751a5be01b66f36b5..73afc8667b1ee656e8f8da0bf272ccb95d72c60f 100644 (file)
--- 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.