Embedding asciidoc manpages in the cg scripts
Subsystems (2)
RFC 1/1 Embedding asciidoc manpages in the cg scripts
Hi Pasky,
I am still a bit unsure how you want to embed asciidoc in the cg scripts so I hope you will comment on this patch probe.
The Makefile stuff is pretty much ripped off from the recent Makefile by David Greaves. I don't know if it should also live in Documentation/Makefile.
You mentioned that you wanted the usage info in the USAGE variable. The variable is initialized so that the usage info can be sed'ed out and become part of the manpage. I assume the reason for this is to add a usage function to cg-Xlib and use it as I have done in cg-add. This should of course be done in a separate patch.
Finally, the embedded asciidoc markup. I still don't understand why you dislike the cg-CMD strings in the NAME section. Asciidoc expects them there and it will be so much harder to add them to the output of $(cg-help cg-CMD).
---
Makefile | 28 +++++++++++++++++++++++++ cg-Xlib | 7 +++++- cg-add | 28 ++++++++++++++++++++++--- cg-commit | 4 +-- cg-log | 68 ++++++++++++++++++++++++++++++++++++++++++++------------------ 5 files changed, 110 insertions(+), 25 deletions(-)
Makefile (mode:100644) +31 -0
@@ -29,6 +29,7 @@ bindir?=$(prefix)/bin libdir?=$(prefix)/lib/cogito +mandir?=$(prefix)/man/man1 CC?=gcc AR?=ar
@@ -136,6 +137,8 @@ $(INSTALL) $(PROG) $(SCRIPTS) $(SCRIPT) $(GEN_SCRIPT) $(DESTDIR)$(bindir) $(INSTALL) -m755 -d $(DESTDIR)$(libdir) $(INSTALL) $(LIB_SCRIPT) $(DESTDIR)$(libdir) + $(INSTALL) -m755 -d $(DESTDIR)$(mandir) + $(INSTALL) $(MANDOC) $(DESTDIR)$(mandir) cd $(DESTDIR)$(bindir); \ for file in $(SCRIPT); do \ sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' $$file > $$file.new; \
@@ -157,3 +160,31 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache + + +DOCSRC = cg-log cg-add +HTMLDIR = Documentation/html +MANDIR = Documentation/man/man1 +HTMLDOC = $(patsubst %,$(HTMLDIR)/%.html,$(DOCSRC)) +MANDOC = $(patsubst %,$(MANDIR)/%.1,$(DOCSRC)) + +doc-clean: + $(RM) $(HTMLDOC) $(MANDOC) + +html: $(HTMLDOC) +man: $(MANDOC) + +$(HTMLDIR): + $(INSTALL) -m755 -d $@ + +$(MANDIR)/%.1: %.xml + xmlto man $< -o $(@D) + +%.xml: %.txt + asciidoc -b docbook -d manpage -o $@ $< + +$(HTMLDIR)/%.html: %.txt $(HTMLDIR) + asciidoc -b css-embedded -d manpage -o $@ $< + +%.txt: % + cg-help $< > $@
cg-Xlib (mode:100755) +6 -1
@@ -17,6 +17,11 @@ exit 1 } +usage () { + echo "usage: $USAGE" >&2 + exit 1 +} + mktemp () { if [ ! "$BROKEN_MKTEMP" ]; then
@@ -52,7 +57,7 @@ print_help () { which "cg-$1" >/dev/null 2>&1 || exit 1 - cat $(which cg-$1) | sed -n '3,/^$/s/^# *//p' + cat $(which cg-$1) | sed 's/^USAGE="\(.*\)"/# \1/' | sed -n '3,/^$/s/^# *//p' exit }
cg-add (mode:100755) +25 -3
@@ -1,14 +1,36 @@ #!/usr/bin/env bash # -# Add new file to a GIT repository. -# Copyright (c) Petr Baudis, 2005 +# CG-ADD(1) +# ========= # +# NAME +# ---- +# cg-add - add files to a GIT repository +# +# SYNOPSIS +# -------- +USAGE="cg-add FILE..." +# +# DESCRIPTION +# ----------- # Takes a list of file names at the command line, and schedules them # for addition to the GIT repository at the next commit. +# +# The command will fail if one of the given files does not exist. +# +# cg-add is part of Cogito, an SCM-like toolkit for managing GIT trees. +# +# OPTIONS +# ------- +# No options. +# +# COPYING +# ------- +# Copyright (c) Petr Baudis, 2005. . ${COGITO_LIB}cg-Xlib -[ "$1" ] || die "usage: cg-add FILE..." +[ "$1" ] || usage for file in "$@"; do if [ -f "$file" ]; then
cg-log (mode:100755) +49 -19
75 lines not on this page · raw message
Signature · 1 line
Jonas Fonseca
Dear diary, on Wed, May 11, 2005 at 03:44:45AM CEST, I got a letter where Jonas Fonseca <[email protected]> told me that...
cg-add (mode:100755) line 4
Quoted 11 lines
Index: cg-add
===================================================================cg-add (mode:100755) +2
-2@@ -1,14 +1,36 @@ #!/usr/bin/env bash # -# Add new file to a GIT repository. -# Copyright (c) Petr Baudis, 2005 +# CG-ADD(1) +# =========
This is really awful - it carries no interesting information whatsoever since that is pretty obvious from the fact that it is in file called cg-add.
cg-add (mode:100755) line 8
Quoted 4 lines
cg-add (mode:100755) +3
-0# +# NAME +# ---- +# cg-add - add files to a GIT repository
Half of this is useless, too.
I think you should just keep the first paragraph of the files as it is now. Don't touch it, just parse it.
cg-add (mode:100755) line 11
Quoted 3 lines
cg-add (mode:100755) +3
-0+# +# SYNOPSIS +# --------
No need for this heading either.
cg-add (mode:100755) line 21
Quoted 10 lines
cg-add (mode:100755) +8
-0+USAGE="cg-add FILE..." +# +# DESCRIPTION +# ----------- # Takes a list of file names at the command line, and schedules them # for addition to the GIT repository at the next commit. +# +# The command will fail if one of the given files does not exist. +# +# cg-add is part of Cogito, an SCM-like toolkit for managing GIT trees.
Useless.
cg-add (mode:100755) line 25
Quoted 4 lines
cg-add (mode:100755) +4
-0+# +# OPTIONS +# ------- +# No options.
The rest of DESCRIPTION and OPTIONS looks fine.
I'd just expect you to be much less intrusive in the in-file comments and do more work when processing the stuff. I'm commenting on how it looks inside of the sources - do whatever is necessary when processing it to generate a proper-looking manpage from it.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Quoted 9 lines · Petr Baudis
cg-add (mode:100755) line 8
Quoted 6 lines
#
cg-add (mode:100755) +3
-0+# NAME +# ---- +# cg-add - add files to a GIT repositoryHalf of this is useless, too.
Quoted 4 lines
I think you should just keep the first paragraph of the files as it is now. Don't touch it, just parse it.
A bit harsh Petr.
Isn't the idea of using an already written tool that you don't _have_ to parse it?
Where, consistently, do the cg-files have a 1 line summary.
Quoted 8 lines
cg-add (mode:100755) line 11
Quoted 5 lines
cg-add (mode:100755) +3
-0+# +# SYNOPSIS +# --------No need for this heading either.
Actually there is :)
asciidoc won't produce a manpage without it.
Quoted 6 lines
Quoted 6 lines
cg-add (mode:100755) +4
-0+USAGE="cg-add FILE..." +# +# DESCRIPTION +# -----------# Takes a list of file names at the command line, and schedules them
# for addition to the GIT repository at the next commit.
Quoted 10 lines
cg-add (mode:100755) line 21
Quoted 6 lines
cg-add (mode:100755) +4
-0+# +# The command will fail if one of the given files does not exist. +# +# cg-add is part of Cogito, an SCM-like toolkit for managing GIT trees.Useless.
Yes - if you happen to have written and breathed the code - not so useless if you're a normal user.
It cogito is ever installed as part of a distro (maybe even by default) then it would be nice if "man cg-add" actually mentioned it was part of cogito and git...
Quoted 9 lines
cg-add (mode:100755) line 25
Quoted 6 lines
cg-add (mode:100755) +4
-0+# +# OPTIONS +# ------- +# No options.The rest of DESCRIPTION and OPTIONS looks fine.
Quoted 6 lines
I'd just expect you to be much less intrusive in the in-file comments and do more work when processing the stuff. I'm commenting on how it looks inside of the sources - do whatever is necessary when processing it to generate a proper-looking manpage from it.
Having worked hard on being consistent throughout the git docs I'd say that a little excess verbiage in the comments is a worthwhile price. I don't think you can worry about performance or anything - these _are_ shell scripts!
Maybe you'd be happier if they were moved to the bottom of the file and preceded with:
#asciidoc follows
Or if you don't like that then maybe keep them external.
David
Dear diary, on Thu, May 12, 2005 at 12:20:10AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 11 lines
Quoted 9 lines · Petr Baudis
cg-add (mode:100755) line 8
Quoted 6 lines
#
cg-add (mode:100755) +3
-0+# NAME +# ---- +# cg-add - add files to a GIT repositoryHalf of this is useless, too.
Quoted 5 lines
Quoted 4 lines
I think you should just keep the first paragraph of the files as it is now. Don't touch it, just parse it.
A bit harsh Petr.
Sorry, I didn't mean to sound (too) harsh. ;-)
Quoted 2 lines
Isn't the idea of using an already written tool that you don't _have_ to parse it?
No, the idea is to get nice output while keeping the input easily human readable. I'm only stretching that further, since we know more than asciidoc itself does about the file. :-)
Quoted 1 line
Where, consistently, do the cg-files have a 1 line summary.
I can't parse this sentence, I fear. All the cg-files have a 1 line summary, then one or more copyright lines, then the description 'n stuff. That's fixed format, much like the git commit format.
Quoted 10 lines
Quoted 8 lines
cg-add (mode:100755) line 11
Quoted 5 lines
cg-add (mode:100755) +3
-0+# +# SYNOPSIS +# --------No need for this heading either.
Actually there is :)
asciidoc won't produce a manpage without it.
So the script piping this to asciidoc can add this at the proper point.
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
cg-add (mode:100755) +4
-0+USAGE="cg-add FILE..." +# +# DESCRIPTION +# -----------# Takes a list of file names at the command line, and schedules them
# for addition to the GIT repository at the next commit.Quoted 10 lines
cg-add (mode:100755) line 21
Quoted 6 lines
cg-add (mode:100755) +4
-0+# +# The command will fail if one of the given files does not exist. +# +# cg-add is part of Cogito, an SCM-like toolkit for managing GIT trees.Useless.
Quoted 2 lines
Yes - if you happen to have written and breathed the code - not so useless if you're a normal user.
Sorry, I've meant only the "cg-add is part of Cogito, an SCM-like toolkit for managing GIT trees" part is useless.
Quoted 3 lines
It cogito is ever installed as part of a distro (maybe even by default) then it would be nice if "man cg-add" actually mentioned it was part of cogito and git...
Yes. I'm fine with it being in the manpage. I just don't want it in the code since again, it is obvious there. And code (be it program code or documentation code) duplication is wrong, if you have a non-trivial chunk repeated over and over everywhere, you probably want to move it to a single place. That'd be the conversion script here.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Petr Baudis <[email protected]> wrote Thu, May 12, 2005:
Quoted 10 lines
Dear diary, on Thu, May 12, 2005 at 12:20:10AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 8 lines
Quoted 6 lines · Petr Baudis
Review
Quoted 3 lines
(quoted diff) +3
-0+# NAME +# ---- +# cg-add - add files to a GIT repositoryHalf of this is useless, too.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
I think you should just keep the first paragraph of the files as it is now. Don't touch it, just parse it.
A bit harsh Petr.
Sorry, I didn't mean to sound (too) harsh. ;-)
Don't mind that you are harsh if it makes sense and I must agree that having a helper script really paid off reducing the added markup to almost a half (in my initial patches). Plus, it is now easy to enhance the manpages with links to referenced commands without having stuff like 'link:' markup in the script headers.
I ended up actually adding two scripts. One for lifting cg-* manpages and one for generating a cogito manpage with an overview of commands and information about command identifiers.
The generated manpages can be previewed at:
http://www.nitro.dk/~jonas/cogito/manpages/cogito.html
Signature · 1 line
Jonas Fonseca
[PATCH] Cogito manpages
Add asciidoc markup to Cogito script headers. Add a script to generate asciidoc manpages from the cg-* command headers and a script for generating a cogito(1) manpage. Finally, add build rules for making Cogito manpages.
Notes:
* USAGE variables are added which can later be used by cg-help or die().
* The command identifiers are name wrapped in '<'/'>' like in the GIT manpages and are not similar to those in cg-help.
* The top-level Makefile is changed to add a script header to cg-version so it could also have a man pages. Don't know if that belongs there or in Documentation/cg-version.txt. Anyway, in order to minimize the patch I cleaned up the checking of .git/HEAD.
* I had trouble getting asciidoc to accept the line
git+ssh://[user@]host/path
I couldn't figure out how to escape it so I changed it to
git+ssh://host/path or git+ssh://user@host/path
Finally the example with referencing branches via #fragments I shortened the rsync URL so the line breaking '\' was not needed.
* The description of -r options should be carefully reviewed. I changed them to be more alike across cg-{diff,log,mkpatch} and some of the original ones looked wrong.
--- Documentation/Makefile | 11 ++ Documentation/make-cg-manpage | 65 ++++++++++++++++ Documentation/make-cogito-manpage | 149 ++++++++++++++++++++++++++++++++++++++ Makefile | 33 +++++--- cg-add | 18 ++++ cg-admin-lsobj | 35 +++++++- cg-admin-uncommit | 28 ++++--- cg-branch-add | 44 ++++++----- cg-branch-ls | 19 ++++ cg-cancel | 19 +++- cg-clone | 17 +++- cg-commit | 95 +++++++++++++++++++----- cg-diff | 29 +++++-- cg-export | 15 +++ cg-help | 17 ++++ cg-init | 15 +++ cg-log | 71 +++++++++++++----- cg-ls | 35 ++++++++ cg-merge | 25 ++++-- cg-mkpatch | 39 ++++++++- cg-patch | 11 ++ cg-pull | 15 +++ cg-restore | 24 ++++-- cg-rm | 11 ++ cg-seek | 26 ++++-- cg-status | 30 +++++++ cg-tag | 15 +++ cg-tag-ls | 9 ++ cg-update | 16 +++- 29 files changed, 785 insertions(+), 151 deletions(-)
Documentation/Makefile (mode:100644) +10 -1
@@ -1,4 +1,7 @@ -DOC_SRC=$(wildcard git*.txt) +CG_IGNORE=$(wildcard ../cg-X*) +CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg-*)) +CG_TXT=cogito.txt $(patsubst ../cg-%,cg-%.txt,$(CG_SRC)) +DOC_SRC=$(wildcard git*.txt) $(CG_TXT) DOC_HTML=$(patsubst %.txt,%.html,$(DOC_SRC)) DOC_MAN=$(patsubst %.txt,%.1,$(DOC_SRC))
@@ -22,3 +25,9 @@ %.xml : %.txt asciidoc -b docbook -d manpage $< + +cogito.txt : make-cogito-manpage + ./make-cogito-manpage > $@ + +cg-%.txt : ../cg-% make-cg-manpage + ./make-cg-manpage $< > $@
Documentation/make-cg-manpage (mode:100755) renamed from dev/null (tree:de641904363cd3759f132ee7c0dfaf8a2ee58388) +65 -0
65 lines not on this page · raw message
Documentation/make-cogito-manpage (mode:100755) renamed from dev/null (tree:de641904363cd3759f132ee7c0dfaf8a2ee58388) +149 -0
149 lines not on this page · raw message
Makefile (mode:100644) +23 -10
@@ -114,20 +114,33 @@ ifneq (,$(wildcard .git)) -cg-version: $(VERSION) .git/HEAD - @echo Generating cg-version... - @rm -f $@ - @echo "#!/bin/sh" > $@ - @echo "echo \"$(shell cat $(VERSION)) ($(shell cat .git/HEAD))\"" >> $@ - @chmod +x $@ -else -cg-version: $(VERSION) +GIT_HEAD=.git/HEAD +GIT_HEAD_ID=" $(shell cat $(GIT_HEAD))" +endif +cg-version: $(VERSION) $(GITHEAD) Makefile @echo Generating cg-version... @rm -f $@ @echo "#!/bin/sh" > $@ - @echo "echo \"$(shell cat $(VERSION))\"" >> $@ + @echo "#" >> $@ + @echo "# Show the version of the Cogito toolkit." >> $@ + @echo "# Copyright (c) Petr Baudis, 2005" >> $@ + @echo "#" >> $@ + @echo "# DESCRIPTION" >> $@ + @echo "# -----------" >> $@ + @echo "# Show which version of Cogito is installed." >> $@ + @echo "# Additionally, the 'HEAD' of the installed Cogito" >> $@ + @echo "# is also shown if this information was available" >> $@ + @echo "# at the build time." >> $@ + @echo "#" >> $@ + @echo "# OPTIONS" >> $@ + @echo "# -------" >> $@ + @echo "# -h, --help::" >> $@ + @echo "# Print usage help." >> $@ + @echo >> $@ + @echo "USAGE=\"cg-version\"" >> $@ + @echo >> $@ + @echo "echo \"$(shell cat $(VERSION))$(GIT_HEAD_ID)\"" >> $@ @chmod +x $@ -endif git.spec: git.spec.in $(VERSION) sed -e 's/@@VERSION@@/$(shell cat $(VERSION) | cut -d"-" -f2)/g' < $< > $@
cg-add (mode:100755) +17 -1
@@ -1,10 +1,26 @@ #!/usr/bin/env bash # -# Add new file to a GIT repository. +# Add files to the GIT repository. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # Takes a list of file names at the command line, and schedules them # for addition to the GIT repository at the next commit. +# +# The command will fail if one of the given files does not exist. +# +# Note that cogito manage content. Which means it doesn't make sense +# to `cg-add` stand-alone directories since directories have no content. +# Instead add a file within the new directory and `cg-add` will create +# a tree for managing the directory as needed. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-add <file>..." . ${COGITO_LIB}cg-Xlib
cg-admin-lsobj (mode:100755) +31 -4
@@ -4,17 +4,44 @@ # Copyright (c) Randy Dunlap, 2005 # Copyright (c) Petr Baudis, 2005 # -# Lists IDs of all the objects of a given type (blob, tree, commit) found -# in the dircache. +# DESCRIPTION +# ----------- +# Lists IDs of all the objects of a given type found in the dircache. +# Takes the object type as the first parameter, defaults to all objects. +# +# The possible object types are: +# `blob`:: +# This object is a pure storage object containing some user data. +# +# `commit`:: +# This object ties directory hierarchies together into a DAG +# of revisions. +# +# `tree`:: +# This object is an object that ties one or more `blob` objects +# into a directory structure. +# +# `tag`:: +# This object ties a symbolic release tag to an object in the +# database. # -# Example usage: +# See the git README for more information about the object types. +# +# EXAMPLE USAGE +# ------------- # Oh, I was messing with my HEADs and lost few commits, where on the earth # could they be...? +# # for i in `cg-admin-lsobj commit | cut -f 1`; do # echo -e "\n==================\nme $i"; cat-file commit $i; # done # -# Takes the object type as the first parameter, defaults to all objects. +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-admin-lsobj [<type>]" . ${COGITO_LIB}cg-Xlib
cg-admin-uncommit (mode:100755) +19 -9
@@ -1,18 +1,28 @@ #!/usr/bin/env bash # -# Undo a commit or a series of commits +# Undo a commit or a series of commits. # Copyright (c) Matt Porter, 2005 # Copyright (c) Petr Baudis, 2005 # -# Optional -t parameter makes cg-admin-uncommit to roll back the tree -# as well to the previous commit. Without this option (by default) -# Cogito keeps the tree in its current state, therefore generating -# tree with local changes against the target commit, consisting of the -# changes in the rolled back commits. +# DESCRIPTION +# ----------- +# Takes a commit ID which is the earliest commit to be removed from +# the repository. If no parameter is passed, it uncommits the latest +# commit ('HEAD'). # -# Takes a commit ID which is the earliest commit to be -# removed from the repository. If no parameter is passed, -# it uncommits the latest commit (HEAD). +# OPTIONS +# ------- +# -t:: +# This optional parameter makes `cg-admin-uncommit` to roll back +# the tree as well to the previous commit. Without this option +# (by default) Cogito keeps the tree in its current state, +# therefore generating tree with local changes against the target +# commit, consisting of the changes in the rolled back commits. +# +# -h, --help:: +# Print usage help. + +USAGE="cg-admin-uncommit [-t] [<commit>]" . ${COGITO_LIB}cg-Xlib
cg-branch-add (mode:100755) +25 -19
60 lines not on this page · raw message
cg-branch-ls (mode:100755) +18 -1
@@ -3,7 +3,24 @@ # List configured GIT branches. # Copyright (c) Steven Cole 2005 # -# Takes no parameters. +# DESCRIPTION +# ----------- +# Print a listing of all known branches. +# +# The output has the following format: +# +# <branch> <location> +# +# For example +# +# origin rsync://rsync.kernel.org/pub/scm/cogito/cogito.git +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-branch-ls" . ${COGITO_LIB}cg-Xlib
cg-cancel (mode:100755) +13 -6
@@ -3,16 +3,23 @@ # Cancels current edits in the working tree. # Copyright (c) Petr Baudis, 2005 # -# This script reverts the working tree to a consistent state before -# any changes to it (including merges etc) were done. +# DESCRIPTION +# ----------- +# Reverts the working tree to a consistent state before any changes to it +# (including merges etc.) were done. # -# Basically, this is the opposite of cg-commit in some sense. +# Basically, this is the opposite of `cg-commit` in some sense. # -# Takes no arguments and the evil changes from the tree. -# -# This command is complementary to cg-restore, which only brings +# This command is complementary to `cg-restore`, which only brings # individual files in sync with their state at the time of the # last commit. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help + +USAGE="cg-cancel" . ${COGITO_LIB}cg-Xlib
cg-clone (mode:100755) +13 -4
@@ -3,16 +3,25 @@ # Clone a remote GIT repository. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # This is like cg-init, but it will create a new directory where it will do # the checkout. # -# If you pass it an optional -s parameter, it does the clone in the current -# directory instead of creating a new one. -# # Takes a parameter specifying the location of the source repository and an -# optional second parameter specifying the destination. If the second +# optional second parameter specifying the destination. If the second # parameter is omitted, the basename of the source repository is used as the # destination. +# +# OPTIONS +# ------- +# -s:: +# Clone in the current directory instead of creating a new one. +# +# -h, --help:: +# Print usage help + +USAGE="cg-clone [-s] <location> [<directory>]" . ${COGITO_LIB}cg-Xlib
cg-commit (mode:100755) +75 -20
101 lines not on this page · raw message
cg-diff (mode:100755) +20 -9
@@ -3,18 +3,29 @@ # Make a diff between two GIT trees. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- +# Outputs a diff for converting the first tree to the second one. # By default compares the current working tree to the state at the -# last commit. You can specify -r rev1:rev2 or -r rev1 -r rev2 to -# tell it to make a diff between the specified revisions. If you -# do not specify a revision, the current working tree is implied -# (note that no revision is different from empty revision - -r rev: -# compares between rev and HEAD, while -r rev compares between rev -# and working tree). +# last commit. # -# -p instead of one ID denotes a parent commit to the specified ID -# (which must not be a tree, obviously). +# OPTIONS +# ------- +# -p:: +# Instead of one ID denotes a parent commit to the specified ID +# (which must not be a tree, obviously). # -# Outputs a diff converting the first tree to the second one. +# -r <commit>[:<commit>]:: +# Specify the revisions to diff using either '-r rev1:rev2' or +# '-r rev1 -r rev2'. If no revision is specified, the current +# working tree is implied. Note that no revision is different from +# empty revision which means '-r rev:' compares between 'rev' and +# 'HEAD', while '-r rev' compares between 'rev' and working tree. +# +# -h, --help:: +# Print usage help. + +USAGE="cg-diff [-p] [-r <commit>[:<commit>]] [<file>]..." . ${COGITO_LIB}cg-Xlib
cg-export (mode:100755) +12 -3
@@ -3,12 +3,21 @@ # Exports a particular revision from a GIT repository. # Copyright (c) Johannes E. Schindelin, 2005 # -# Takes a destination and optionally an id as a parameter, -# defaulting to HEAD. +# DESCRIPTION +# ----------- +# Takes a destination and optionally a tree ID as a parameter, +# defaulting to 'HEAD'. # -# The destination can be either a .tar, .tar.gz, .tar.bz2 or .tgz +# The destination can be either a `.tar`, `.tar.gz`, `.tar.bz2` or `.tgz` # for generating a tarball. Other destination specifiers are assumed # to be directory names, and the tree is exported to the given directory. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-export <destination> [<tree>]" . ${COGITO_LIB}cg-Xlib
cg-help (mode:100755) +16 -1
@@ -1,9 +1,24 @@ #!/usr/bin/env bash # -# The help for the Cogito toolkit. +# Show help for Cogito commands. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # Takes an optional argument describing the command to show the help for. +# The command can be specified either as '<command>' or 'cg-<command>'. +# If the argument is left out an overview of all the Cogito commands will +# be shown. +# +# Note help for a command is also available by passing `--help` or `-h` +# to the command. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help + +USAGE="cg-help [<command>]" . ${COGITO_LIB}cg-Xlib
cg-init (mode:100755) +12 -3
@@ -3,10 +3,19 @@ # Initialize a GIT repository. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # Takes an optional parameter which will make it "clone" a specified -# remote repository. Note that this usage is DEPRECATED - use cg-clone -# (possibly with the -s parameter) for doing this. This functionality -# will go away from cg-init soon. +# remote repository. Note that this usage is 'DEPRECATED'. Instead use +# `cg-clone` (possibly with the `-s` parameter) for doing this. This +# functionality will go away from `cg-init` soon. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-init" . ${COGITO_LIB}cg-Xlib
cg-log (mode:100755) +52 -19
78 lines not on this page · raw message
cg-ls (mode:100755) +34 -1
@@ -3,7 +3,40 @@ # List contents of a particular tree in a GIT repository. # Copyright (c) Petr Baudis, 2005 # -# Optionally takes commit or tree id as a parameter, defaulting to HEAD. +# DESCRIPTION +# ----------- +# Optionally takes a commit or tree ID as a parameter, defaulting to +# 'HEAD'. +# +# Each line in the output has the following format: +# +# <mode> <type> <sha1> <name> +# +# where +# +# '<mode>':: +# The file permission information in octal format. +# +# '<type>':: +# The type can be the following: `blob` refers to files +# and `tree` refers to directories. +# +# '<sha1>':: +# The object ID. +# +# '<name>':: +# The file or directory name. +# +# An example line might look like: +# +# 100644 blob c7dacd0ea28994e3c754ca4eadb2e08c011ee3d3 README +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-ls [<tree>]" . ${COGITO_LIB}cg-Xlib
cg-merge (mode:100755) +19 -6
@@ -3,15 +3,28 @@ # Merge a branch to the current tree. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # Takes a parameter identifying the branch to be merged. -# Optional "-b base_commit" parameter specifies the base for the merge. -# Optional "-c" parameter specifies that you want to have tree merge -# never autocomitted, but want to review and commit it manually. # -# You have to examine the tree after the merge and then do cg-commit. +# You have to examine the tree after the merge and then do `cg-commit`. # -# Alternatively, it will just bring the HEAD forward, if your current -# HEAD is also the merge base. +# Alternatively, it will just bring the 'HEAD' forward, if your current +# 'HEAD' is also the merge base. +# +# OPTIONS +# ------- +# -b <commit>:: +# Parameter specifies the base commit for the merge. +# +# -c:: +# Parameter specifies that you want to have tree merge never +# autocomitted, but want to review and commit it manually. +# +# -h, --help:: +# Print usage help. + +USAGE="cg-merge [-c] [-b <commit>] <branch>" . ${COGITO_LIB}cg-Xlib
cg-mkpatch (mode:100755) +33 -6
@@ -1,14 +1,41 @@ #!/usr/bin/env bash # -# Make a patch from a given commit. +# Make a patch from one or several commits. # Copyright (c) Petr Baudis, 2005 # -# Takes an -s option which specifies whether to print a short -# version of the patch without a patch header with meta info such -# as author and committer. +# DESCRIPTION +# ----------- +# Generate a patch with diff statistics and meta info about each commit. # -# Takes an -r followed with ID defaulting to HEAD, or id1:id2, forming -# a range (id1;id2]. (Use "id1:" to take just everything from id1 to HEAD.) +# OPTIONS +# ------- +# -s:: +# Specify whether to print a short version of the patch without +# a patch header with meta info such as author and committer. +# +# -r <commit>[:<commit>]:: +# Specify a set of commits to make patches from using either +# '-r FROM_ID[:TO_ID]' or '-r FROM_ID -r TO_ID'. In both cases the +# option expects IDs which resolve to commits and will include the +# specified IDs. If 'TO_ID' is omitted patches for all commits +# from 'FROM_ID' to the initial commit will be generated. If no +# `-r` option is given the commit ID defaults to 'HEAD'. +# +# -h, --help:: +# Print usage help. +# +# EXAMPLE USAGE +# ------------- +# To make patches for all commits between two releases tagged as +# 'releasetag-0.9' and 'releasetag-0.10' do: +# +# $ cg-mkpatch -r releasetag-0.9:releasetag-0.10 +# +# The output will be a contionuos dump of patches each separated by +# the line +# `!-------------------------------------------------------------flip-` + +USAGE="cg-mkpatch [-s] [-r <commit>[:<commit>]]" . ${COGITO_LIB}cg-Xlib
cg-patch (mode:100755) +10 -1
@@ -1,12 +1,21 @@ #!/usr/bin/env bash # -# Apply a diff generated by git diff. +# Apply a diff generated by cg-diff. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # This is basically just a smart patch wrapper. It handles stuff like # mode changes, removal of files vs. zero-size files etc. # # Takes the diff on stdin. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-patch < patch on stdin" . ${COGITO_LIB}cg-Xlib
cg-pull (mode:100755) +12 -3
@@ -1,11 +1,20 @@ #!/usr/bin/env bash # -# Pulls changes from remote branch to the local GIT repository. -# Copyright (c) Petr Baudis, 2005 +# Pull changes from a remote branch to the local GIT repository. +# Copyright (c) Petr Baudis, 2005. +# +# DESCRIPTION +# ----------- +# Takes the branch name as an argument, defaulting to "origin". # # See cg-branch-add for some description. # -# Takes the branch' name, defaulting to "origin". +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-pull [<branch>]" . ${COGITO_LIB}cg-Xlib
cg-restore (mode:100755) +16 -8
@@ -1,21 +1,29 @@ #!/usr/bin/env bash # -# Restores files removed/changed in the working tree. +# Restore removed/changed files in the working tree. # Copyright (c) Petr Baudis, 2005 # -# This script restores given files to their original state. -# -# Without any parameters, it recovers any files removed locally -# whose removal was not recorded by cg-rm. +# DESCRIPTION +# ----------- +# Restore given files to their original state. Without any parameters, +# it recovers any files removed locally whose removal was not recorded +# by `cg-rm`. # # If passed a set of file names, it restores those files to their -# state as of the last commit (including bringing cg-rm'd files -# back to life; FIXME: does not do that part yet). +# state as of the last commit (including bringing files removed with +# `cg-rm` back to life; FIXME: does not do that part yet). # -# This command is complementary to the cg-cancel command, which +# This command is complementary to the `cg-cancel` command, which # forcefully abandons all the changes in the working tree and # restores everything to a proper state (including unseeking, # cancelling merge in progress and rebuilding indexes). +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-restore [<file>]..." . ${COGITO_LIB}cg-Xlib
cg-rm (mode:100755) +10 -1
@@ -1,10 +1,19 @@ #!/usr/bin/env bash # -# Remove a file from a GIT repository. +# Remove files from a GIT repository. # Copyright (c) Petr Baudis, 2005 # +# DESCRIPTION +# ----------- # Takes a list of file names at the command line, and schedules them # for removal from the GIT repository at the next commit. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-rm <file>..." . ${COGITO_LIB}cg-Xlib
cg-seek (mode:100755) +17 -9
@@ -3,22 +3,30 @@ # Seek the working tree to a given commit. # Copyright (c) Petr Baudis, 2005 # -# This will bring the working tree from its current HEAD to a given -# commit. Note that it changes just the HEAD of the working tree, not -# the branch it is corresponding to. It will return to the HEAD of +# DESCRIPTION +# ----------- +# Takes the target commit ID to seek to as an argument. +# Seeking will bring the working tree from its current 'HEAD' to a given +# commit. Note that it changes just the 'HEAD' of the working tree, not +# the branch it is corresponding to. It will return to the 'HEAD' of # the appropriate branch if passed no arguments. # # Therefore, for a quick excurse to the past of the 'master' branch: # -# cg-seek git-pasky-0.1 -# cg-diff this master # will do the correct thing -# cg-seek # will restore what we had before +# $ cg-seek git-pasky-0.1 +# $ cg-diff this master # will do the correct thing +# $ cg-seek # will restore what we had before # -# For intuitiveness, specifying the branch name (cg-seek master) will do +# For intuitiveness, specifying the branch name (`cg-seek master`) will do # the right thing too. If you want to migrate your working tree to another -# branch, use cg-fork. +# branch, use `cg-fork`. # -# Takes the target commit ID. +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-seek <commit>" . ${COGITO_LIB}cg-Xlib
cg-status (mode:100755) +29 -1
@@ -3,7 +3,35 @@ # Show status of entries in your working tree. # Copyright (c) Petr Baudis, 2005 # -# Takes no arguments. +# DESCRIPTION +# ----------- +# Print of files in the working tree. +# +# The output has the following format: +# +# <status flag> <file> +# +# where '<status flag>' can be one of the following: +# +# `?`:: +# '<file>' is unknown. +# `M`:: +# '<file>' has been touched or modified. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. +# +# FILES +# ----- +# $GIT_DIR/exclude:: +# If the file exists it will be used to prune which files to +# show status for. The format is similar to the `dontdiff` file; +# each line contains a pattern for a file or group of files +# to exclude. + +USAGE="cg-status" . ${COGITO_LIB}cg-Xlib
cg-tag (mode:100755) +12 -3
@@ -3,10 +3,19 @@ # Mark certain commit by a tag. # Copyright (c) Petr Baudis, 2005 # -# Creates a tag referencing the given commit (or HEAD). You can then -# use the tag anywhere you specify a commit/tree ID. +# DESCRIPTION +# ----------- +# Creates a tag referencing the given commit (or 'HEAD'). You can then +# use the tag anywhere you specify a commit or tree ID. # -# Takes the tag's name and optionally the associated ID. +# Takes the tag name and optionally the associated ID as arguments. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-tag <tag> [<commit>]" . ${COGITO_LIB}cg-Xlib
cg-tag-ls (mode:100755) +9 -0
@@ -3,7 +3,16 @@ # List stored GIT tags. # Copyright (c) Steve Hoelzer 2005 # +# DESCRIPTION +# ----------- # Takes no parameters. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-tag-ls" . ${COGITO_LIB}cg-Xlib
cg-update (mode:100755) +14 -2
@@ -1,9 +1,21 @@ #!/usr/bin/env bash # -# Pulls changes from another branch to the local repository and merge changes. +# Pull and merge changes from a branch to the local repository. # Copyright (c) Petr Baudis, 2005 # -# Takes the branch' name, defaulting to "origin". +# DESCRIPTION +# ----------- +# Takes the branch name as an argument, defaulting to 'origin'. +# +# If local changes conflict with those of the branch updated from the +# merge will be blocked. +# +# OPTIONS +# ------- +# -h, --help:: +# Print usage help. + +USAGE="cg-update [<branch>]" . ${COGITO_LIB}cg-Xlib