Compare commits
48 commits
Author | SHA1 | Date | |
---|---|---|---|
987a6137a7 | |||
|
7804cc2af1 | ||
b8dc0c68b7 | |||
420b55c52c | |||
3c831f9381 | |||
53db54e71d | |||
7a0c947c10 | |||
bc4555b0dd | |||
dba15ac990 | |||
aacc242fb3 | |||
9df3b848e0 | |||
95125d682c | |||
ea945c83fa | |||
2dd972c770 | |||
e72c093057 | |||
d5f38b4f6d | |||
78b63229f6 | |||
73961321ff | |||
3036734e4b | |||
0272a7d17e | |||
d1245a3d7f | |||
040ef0d5e0 | |||
442b8f9122 | |||
f81fcc9a8a | |||
aab22cbb6e | |||
87a300c389 | |||
39b5431da1 | |||
b1a2359036 | |||
a936e985a4 | |||
5f3dfee5ac | |||
c00a0ca730 | |||
62627e6cf6 | |||
1027b3c7d6 | |||
e027f3c7e6 | |||
7f6037855d | |||
aa0accc977 | |||
|
5c0189e9ca | ||
dd41bb1272 | |||
6c05056f84 | |||
439a262ec4 | |||
8b3f0d16d3 | |||
cd8a7c310c | |||
1be9047b00 | |||
7cf38f5121 | |||
70eca89c39 | |||
e293a71f9c | |||
e2c303c420 | |||
d2db2dfb53 |
27 changed files with 2029 additions and 220 deletions
24
CONTRIBUTING
Normal file
24
CONTRIBUTING
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- mode: org; -*-
|
||||
#+STARTUP: showall
|
||||
|
||||
If you wish to contribute you can use either the sources located on
|
||||
[[http://code.ryuslash.org/cgit.cgi/gitto/][ryuslash.org]] or the [[https://github.com/ryuslash/gitto][github]] sources.
|
||||
|
||||
* Getting the source
|
||||
|
||||
If you wish to work on ~gitto~ you can get the sources by cloning the
|
||||
repository:
|
||||
|
||||
: git clone git://ryusalsh.org/git-auto-commit-mode.git
|
||||
|
||||
* Style
|
||||
|
||||
Use spaces, don't use tabs. If you can, keep lines shorter than 80
|
||||
characters. Other than that, Emacs can handle indentation pretty
|
||||
well. [[http://www.nongnu.org/geiser/][Geiser]] can help too, if you're using Emacs.
|
||||
|
||||
* Patches
|
||||
|
||||
If you want to send any patches I prefer an email with the output
|
||||
generated by =git request-pull=, possibly with =-p=, over things like
|
||||
github pull requests, but nothing will be turned away.
|
36
INSTALL
Normal file
36
INSTALL
Normal file
|
@ -0,0 +1,36 @@
|
|||
# -*- mode: org; -*-
|
||||
#+STARTUP: showall
|
||||
|
||||
In order to install ~gitto~, just run:
|
||||
|
||||
: make install
|
||||
|
||||
This will install ~gitto~ to ~/usr/local/~, if you would like to install
|
||||
it somewhere else you can use the =DESTDIR= variable:
|
||||
|
||||
: make install DESTDIR=/some/other/place
|
||||
|
||||
This will install ~gitto~ to =/some/other/place/=.
|
||||
|
||||
* Packages
|
||||
|
||||
- There is also a [[https://aur.archlinux.org/packages/gitto-git/][package]] in the [[http://aur.archlinux.org][Archlinux User Repository]], which
|
||||
installs the latest git checkout.
|
||||
|
||||
* Requirements
|
||||
|
||||
~gitto~ requires [[http://www.gnu.org/software/guile/][GNU Guile]] version 2.0.9 or newer to be available.
|
||||
|
||||
* Removal
|
||||
|
||||
If you're fed up with ~gitto~ and want it gone you can run:
|
||||
|
||||
: make uninstall
|
||||
|
||||
This will remove any ~gitto~ installed files from ~/usr/local/~. If you
|
||||
used the =DESTDIR= variable during installation, you should give it
|
||||
the same value here, like:
|
||||
|
||||
: make uninstall DESTDIR=/some/other/place
|
||||
|
||||
This will remove any ~gitto~ installed files from ~/some/other/place/~.
|
16
Makefile
16
Makefile
|
@ -1,14 +1,21 @@
|
|||
export DESTDIR ?= /usr
|
||||
INSTALL = install -D
|
||||
|
||||
dirs = src gitto
|
||||
export DESTDIR ?= /usr/local
|
||||
export INSTALL_PROGRAM = $(INSTALL)
|
||||
export INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
dirs = doc src gitto zsh
|
||||
install-dirs = $(addprefix install-,$(dirs))
|
||||
uninstall-dirs = $(addprefix uninstall-,$(dirs))
|
||||
clean-dirs = $(addprefix clean-,$(dirs))
|
||||
|
||||
.PHONY: all $(dirs) install $(install-dirs) uninstall $(uninstall-dirs)
|
||||
.PHONY: all $(dirs) install $(install-dirs) uninstall $(uninstall-dirs) \
|
||||
clean $(clean-dirs)
|
||||
|
||||
all: $(dirs)
|
||||
install: $(install-dirs)
|
||||
uninstall: $(uninstall-dirs)
|
||||
clean: $(clean-dirs)
|
||||
|
||||
$(dirs):
|
||||
$(MAKE) -C $@/
|
||||
|
@ -18,3 +25,6 @@ $(install-dirs): install-%:
|
|||
|
||||
$(uninstall-dirs): uninstall-%:
|
||||
$(MAKE) -C $*/ uninstall
|
||||
|
||||
$(clean-dirs): clean-%:
|
||||
$(MAKE) -C $*/ clean
|
||||
|
|
98
README.org
98
README.org
|
@ -1,71 +1,59 @@
|
|||
* Gitto
|
||||
#+TITLE: gitto
|
||||
#+STARTUP: showall
|
||||
|
||||
* NAME
|
||||
|
||||
gitto - A silly utility to track the status of some git
|
||||
repositories.
|
||||
|
||||
* SYNOPSIS
|
||||
|
||||
=gitto [command [subcommand] [args...]]=
|
||||
|
||||
* DESCRIPTION
|
||||
|
||||
For lack of a better title.
|
||||
|
||||
My simple utility to keep track of all the git repositories I have
|
||||
on my computer(s). Also an experiment in writing scheme.
|
||||
My simple utility to keep track of all the git repositories I have on
|
||||
my computer(s). Also an experiment in writing scheme.
|
||||
|
||||
Written for [[http://gnu.org/software/guile][GNU Guile]] 2.0.x
|
||||
Written for [[http://gnu.org/software/guile][GNU Guile]] 2.0.9 or newer
|
||||
|
||||
** Installation
|
||||
* USAGE
|
||||
|
||||
Installing ~gitto~ is not really necessary, but it *is* more
|
||||
convenient. In order to install it just run:
|
||||
Usage is, hopefully, simple, first you have to register some repos:
|
||||
|
||||
: make install
|
||||
: $ gitto add ~/projects/project1
|
||||
: $ gitto add ~/projects/project2
|
||||
: $ gitto add ~/projects/project3
|
||||
|
||||
This will install ~gitto~ to ~/usr/local/~, if you would like it
|
||||
somewhere else you could use the ~DESTDIR~ variable:
|
||||
Then you can call ~gitto~ without any argument to see a list of your
|
||||
repos and their statuses:
|
||||
|
||||
: make install DESTDIR=/some/other/place
|
||||
: $ gitto
|
||||
: project1: Worktree is dirty
|
||||
: master: 0 to push and 0 to pull. Last update: 4 weeks ago
|
||||
:
|
||||
: project2: Worktree is clean
|
||||
: master: 5 to push and 2 to pull. Last update: 2 days ago
|
||||
:
|
||||
: project3: Worktree is clean
|
||||
: master: 0 to push and 1 to pull. Last update: 1 hour ago
|
||||
|
||||
This will install ~gitto~ to ~/some/other/place/~.
|
||||
If you're done with one of your projects and no longer wish to track
|
||||
their status you can unregister them:
|
||||
|
||||
** Removal
|
||||
: $ gitto remove ~/projects/project1
|
||||
|
||||
If you're fed up with ~gitto~ and want it gone, and I do mean *now*,
|
||||
you can run:
|
||||
If you require further assistance:
|
||||
|
||||
: make uninstall
|
||||
: $ gitto help
|
||||
|
||||
This will remove any ~gitto~ installed files from ~/usr/local/~, if you
|
||||
used the ~DESTDIR~ variable during installation, you should give it
|
||||
the same value here, like:
|
||||
** run-gitto
|
||||
|
||||
: make uninstall DESTDIR=/some/other/place
|
||||
It is not strictly necessary to install gitto, I have added a
|
||||
utility to run it straight from the project directory, although
|
||||
mostly for testing purposes.
|
||||
|
||||
This will remove any ~gitto~ installed files from ~/some/other/place/~.
|
||||
|
||||
** Usage
|
||||
|
||||
Usage is, hopefully, simple, first you have to register some repos:
|
||||
|
||||
: $ gitto -r ~/projects/project1
|
||||
: $ gitto -r ~/projects/project2
|
||||
: $ gitto -r ~/projects/project3
|
||||
|
||||
Then you can call ~gitto~ without any argument to see a list of your
|
||||
repos and their statuses:
|
||||
|
||||
: $ gitto
|
||||
: project1: 0 to push, 0 to pull and is dirty
|
||||
: project2: 5 to push, 2 to pull and is not dirty
|
||||
: project3: 0 to push, 1 to pull and is not dirty
|
||||
|
||||
If you're done with one of your projects and no longer wish to
|
||||
track their status you can unregister them:
|
||||
|
||||
: $ gitto -R ~/projects/project1
|
||||
|
||||
If you require further assistance:
|
||||
|
||||
: $ gitto -h
|
||||
|
||||
*** run-gitto
|
||||
|
||||
As I mentioned, it is not completely necessary to install gitto, I
|
||||
have added a utility to run it straight from je project directory,
|
||||
although mostly for testing purposes.
|
||||
|
||||
Using ~run-gitto~ works exactly the same as using ~gitto~ when it is
|
||||
installed.
|
||||
Using ~run-gitto~ works exactly the same as using ~gitto~ when it is
|
||||
installed.
|
||||
|
|
3
doc/.gitignore
vendored
Normal file
3
doc/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
html/
|
||||
gitto.*
|
||||
!gitto.texi
|
59
doc/Makefile
Normal file
59
doc/Makefile
Normal file
|
@ -0,0 +1,59 @@
|
|||
DESTDIR ?= /usr/local
|
||||
INSTALL_INFO = install-info
|
||||
TEXI2PDF = texi2pdf
|
||||
DVIPS = dvips
|
||||
|
||||
.PHONY: all html dvi pdf ps install uninstall install-dvi install-pdf \
|
||||
install-ps clean
|
||||
|
||||
all: gitto.info
|
||||
|
||||
install: gitto.info
|
||||
$(INSTALL_DATA) gitto.info "$(DESTDIR)/share/info/gitto.info"
|
||||
$(INSTALL_INFO) --dir-file="$(DESTDIR)/share/info/dir" \
|
||||
"$(DESTDIR)/share/info/gitto.info"
|
||||
|
||||
uninstall:
|
||||
$(INSTALL_INFO) --dir-file="$(DESTDIR)/share/info/dir" \
|
||||
--delete "$(DESTDIR)/share/info/gitto.info"
|
||||
rm -f "$(DESTDIR)/share/info/gitto.info"
|
||||
rm -f "$(DESTDIR)/share/doc/gitto/dvi/gitto.dvi"
|
||||
rm -f "$(DESTDIR)/share/doc/gitto/pdf/gitto.pdf"
|
||||
rm -f "$(DESTDIR)/share/doc/gitto/ps/gitto.ps"
|
||||
rm -rf "$(DESTDIR)/share/doc/gitto/html/"
|
||||
|
||||
install-dvi: gitto.dvi
|
||||
$(INSTALL_DATA) gitto.dvi \
|
||||
"$(DESTDIR)/share/doc/gitto/dvi/gitto.dvi"
|
||||
|
||||
install-pdf: gitto.pdf
|
||||
$(INSTALL_DATA) gitto.pdf \
|
||||
"$(DESTDIR)/share/doc/gitto/pdf/gitto.pdf"
|
||||
|
||||
install-ps: gitto.ps
|
||||
$(INSTALL_DATA) gitto.ps \
|
||||
"$(DESTDIR)/share/doc/gitto/ps/gitto.ps"
|
||||
|
||||
gitto.info: gitto.texi
|
||||
|
||||
html: gitto.texi
|
||||
$(MAKEINFO) --html gitto.texi -o html
|
||||
|
||||
dvi: gitto.dvi
|
||||
pdf: gitto.pdf
|
||||
ps: gitto.ps
|
||||
|
||||
gitto.dvi: gitto.texi
|
||||
$(TEXI2DVI) gitto.texi
|
||||
|
||||
gitto.pdf: gitto.texi
|
||||
$(TEXI2PDF) gitto.texi
|
||||
|
||||
gitto.ps: gitto.dvi
|
||||
$(DVIPS) gitto.dvi
|
||||
|
||||
clean:
|
||||
rm -f gitto.aux gitto.cp gitto.dvi gitto.fn gitto.fns gitto.info \
|
||||
gitto.ky gitto.log gitto.pdf gitto.pg gitto.ps gitto.toc \
|
||||
gitto.tp gitto.vr gitto.vrs
|
||||
rm -rf html/
|
505
doc/fdl.texi
Normal file
505
doc/fdl.texi
Normal file
|
@ -0,0 +1,505 @@
|
|||
@c The GNU Free Documentation License.
|
||||
@center Version 1.3, 3 November 2008
|
||||
|
||||
@c This file is intended to be included within another document,
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
@uref{http://fsf.org/}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document @dfn{free} in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft'', which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The ``Document'', below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as ``you''. You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, La@TeX{} input
|
||||
format, SGML or XML using a publicly available
|
||||
DTD, and standard-conforming simple HTML,
|
||||
PostScript or PDF designed for human modification. Examples
|
||||
of transparent image formats include PNG, XCF and
|
||||
JPG@. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, SGML or
|
||||
XML for which the DTD and/or processing tools are
|
||||
not generally available, and the machine-generated HTML,
|
||||
PostScript or PDF produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
The ``publisher'' means any person or entity that distributes copies
|
||||
of the Document to the public.
|
||||
|
||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as ``Acknowledgements'',
|
||||
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section ``Entitled XYZ'' according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
@enumerate A
|
||||
@item
|
||||
Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
|
||||
@item
|
||||
List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
|
||||
@item
|
||||
State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
@item
|
||||
Preserve all the copyright notices of the Document.
|
||||
|
||||
@item
|
||||
Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
@item
|
||||
Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
|
||||
@item
|
||||
Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
|
||||
@item
|
||||
Include an unaltered copy of this License.
|
||||
|
||||
@item
|
||||
Preserve the section Entitled ``History'', Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
|
||||
@item
|
||||
Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
|
||||
@item
|
||||
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
|
||||
the Title of the section, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements and/or
|
||||
dedications given therein.
|
||||
|
||||
@item
|
||||
Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
|
||||
@item
|
||||
Delete any section Entitled ``Endorsements''. Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
@item
|
||||
Do not retitle any existing section to be Entitled ``Endorsements'' or
|
||||
to conflict in title with any Invariant Section.
|
||||
|
||||
@item
|
||||
Preserve any Warranty Disclaimers.
|
||||
@end enumerate
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled ``Endorsements'', provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties---for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled ``History''
|
||||
in the various original documents, forming one section Entitled
|
||||
``History''; likewise combine any sections Entitled ``Acknowledgements'',
|
||||
and any sections Entitled ``Dedications''. You must delete all
|
||||
sections Entitled ``Endorsements.''
|
||||
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an ``aggregate'' if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled ``Acknowledgements'',
|
||||
``Dedications'', or ``History'', the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
@uref{http://www.gnu.org/copyleft/}.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
@item
|
||||
RELICENSING
|
||||
|
||||
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
|
||||
site means any set of copyrightable works thus published on the MMC
|
||||
site.
|
||||
|
||||
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
``Incorporate'' means to publish or republish a Document, in whole or
|
||||
in part, as part of another Document.
|
||||
|
||||
An MMC is ``eligible for relicensing'' if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole
|
||||
or in part into the MMC, (1) had no cover texts or invariant sections,
|
||||
and (2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@page
|
||||
@heading ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with@dots{}Texts.''@: line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
with the Invariant Sections being @var{list their titles}, with
|
||||
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
|
||||
being @var{list}.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
@c Local Variables:
|
||||
@c ispell-local-pdict: "ispell-dict"
|
||||
@c End:
|
395
doc/gitto.texi
Normal file
395
doc/gitto.texi
Normal file
|
@ -0,0 +1,395 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename gitto.info
|
||||
@settitle Gitto
|
||||
@c %**end of header
|
||||
@copying
|
||||
Gitto User Manual.
|
||||
|
||||
Copyright @copyright{} 2013 Tom Willemse
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
|
||||
A copy of the license is also available from the Free Software
|
||||
Foundation Web site at @url{http://www.gnu.org/licenses/fdl.html}.
|
||||
|
||||
@end quotation
|
||||
|
||||
The document was typeset with
|
||||
@uref{http://www.texinfo.org/, GNU Texinfo}.
|
||||
|
||||
@end copying
|
||||
|
||||
@titlepage
|
||||
@title Gitto
|
||||
@subtitle Gitto User Manual
|
||||
@author Tom Willemse <tom@@ryuslash.org>
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@dircategory Individual utilities
|
||||
@direntry
|
||||
* Gitto: (gitto). Keep track of your git repositories.
|
||||
@end direntry
|
||||
|
||||
@c Output the table of the contents at the beginning.
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@top Gitto
|
||||
|
||||
This is the manual for gitto. Gitto helps you keep track of the various
|
||||
git repositories you have stored on your hard-drive(s).
|
||||
|
||||
@insertcopying
|
||||
@end ifnottex
|
||||
|
||||
@c Generate the nodes for this menu with `C-c C-u C-m'.
|
||||
@menu
|
||||
* Introduction::
|
||||
* Usage::
|
||||
* Configuration::
|
||||
* Copying This Manual::
|
||||
* Index::
|
||||
@end menu
|
||||
|
||||
@c Update all node entries with `C-c C-u C-n'.
|
||||
@c Insert new nodes with `C-c C-c n'.
|
||||
@node Introduction, Usage, Top, Top
|
||||
@chapter Introduction
|
||||
|
||||
This chapter offers a few introductory sections that will explain why
|
||||
you might want to use gitto and how to get it running.
|
||||
|
||||
@menu
|
||||
* Features::
|
||||
* Installation::
|
||||
@end menu
|
||||
|
||||
@node Features, Installation, Introduction, Introduction
|
||||
@section Features
|
||||
|
||||
gitto was started as a way to view the status of the repositories that
|
||||
were registered with it. It has since also gained somewhat of a
|
||||
management function.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
First, it allows you to see an overview of the status of your git
|
||||
repositories. For each registered repository it will show you the
|
||||
following information:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The name of the repository. This is the directory name in which the
|
||||
repository is located.
|
||||
|
||||
@item
|
||||
The state of the worktree, clean or dirty. Dirty meaning that there are
|
||||
uncommitted changes in the worktree.
|
||||
|
||||
@item
|
||||
It shows the following information for each branch:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
The name of the branch.
|
||||
|
||||
@item
|
||||
How many commits the local repository has that have not been pushed to
|
||||
the branch's upstream remote.
|
||||
|
||||
@item
|
||||
How many commits the branch's upstream remote has that have not been
|
||||
merged into the local repository.
|
||||
|
||||
@item
|
||||
How long ago the last known commit pushed to the branch's upstream
|
||||
remote was. If the branch has no upstream remote this will always be
|
||||
@dfn{Never}.
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
It allows the user to specify a template of settings which can be merged
|
||||
with the registered repository's setting. This makes it easy to
|
||||
generalize your configuration.
|
||||
|
||||
@item
|
||||
Along with specifying a template for configuration settings the user can
|
||||
also specify a list of repository names which should be excluded from
|
||||
the merging of settings. This is useful when you have a few repositories
|
||||
that you don't push to the same remotes or that have different needs for
|
||||
configuration, perhaps because they are forks or clones of someone
|
||||
else's project.
|
||||
|
||||
@item
|
||||
It allows the user to specify a list of hooks which should be installed
|
||||
in the repositories. This also looks at the exclude list and will not
|
||||
install any hooks for projects in the exclude list. This is useful when
|
||||
you have hooks that all your projects use, for example a
|
||||
@file{commit-msg} hook that ensures correct style, or a
|
||||
@file{pre-commit} hook that ensures there are no errors being committed.
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Installation, , Features, Introduction
|
||||
@section Installation
|
||||
|
||||
There is a package available for gitto in the
|
||||
@uref{https://aur.archlinux.org,Archlinux User Repository}@footnote{At
|
||||
https://aur.archlinux.org/packages/gitto-git/}.
|
||||
|
||||
If you don't use Archlinux or you prefer installing it manually you
|
||||
should first grab the source from somewhere and then it is a matter of
|
||||
using:
|
||||
|
||||
@example
|
||||
make
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
and then, as root:
|
||||
|
||||
@example
|
||||
make install
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
or if you wish to install it somewhere other than in the default
|
||||
location:
|
||||
|
||||
@example
|
||||
make install DESTDIR=/path/to/where/you/want/it
|
||||
@end example
|
||||
|
||||
|
||||
@node Usage, Configuration, Introduction, Top
|
||||
@chapter Usage
|
||||
|
||||
In order to use gitto you should first register some repositories. To
|
||||
register a repository you can use the @command{add} command.
|
||||
|
||||
@deffn Command add location
|
||||
This command checks if @var{location} contains a @file{.git} directory,
|
||||
which indicates it being a git repository, and registers @var{location}
|
||||
if so. Example:
|
||||
|
||||
@example
|
||||
gitto add /path/to/your/project
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
If ever you want to stop keeping track of the status of a repository,
|
||||
for example if you have given up on a project, you can use the
|
||||
@command{remove} command.
|
||||
|
||||
@deffn Command remove location
|
||||
Remove @var{location} from the list of registered repositories. This
|
||||
first checks to see whether or not this repository has even been
|
||||
registered.
|
||||
|
||||
@var{location} may be either an absolute or relative path, or it may
|
||||
also be the name of a repository as displayed by @command{list}.
|
||||
|
||||
In case a name is specified and there are multiple possibilities a
|
||||
list will be presented to you and you may choose which of the
|
||||
repositories to remove based on the locations of each repository. The
|
||||
question will be repeated until a valid answer is given (a number
|
||||
appearing in the printed list).
|
||||
@end deffn
|
||||
|
||||
In the event you (re)move some of your repositories and don't have the
|
||||
energy to remove them all, there is also the @command{purge} command.
|
||||
|
||||
@deffn Command purge
|
||||
Goes through all registered repositories and checks if they still exist
|
||||
in the given place. In the case that they don't they are removed from
|
||||
the registered repository list. This is useful when you have moved or
|
||||
deleted a number of repositories.
|
||||
@end deffn
|
||||
|
||||
If you are ever unsure if you have registered a repository or not, you
|
||||
can always use the @command{check} command.
|
||||
|
||||
@deffn Command check location
|
||||
Checks if @var{location} has been registered. Prints the result.
|
||||
@end deffn
|
||||
|
||||
If you merely wish to know the locations of the repositories that have
|
||||
been registered you can use @command{list}'s @command{locations}
|
||||
sub-command.
|
||||
|
||||
@deffn Command list
|
||||
This is the default command, equivalent to calling gitto without any
|
||||
commands specified. It has one sub-command: @command{locations}.
|
||||
|
||||
@deffn Sub-Command locations
|
||||
This lists the absolute file names of the registered repositories.
|
||||
@end deffn
|
||||
@end deffn
|
||||
|
||||
If you wish to manage your git configurations in a global way you can
|
||||
use the various @command{config} commands.
|
||||
|
||||
@deffn Command config
|
||||
This command shows a list of all the configurations of all the
|
||||
registered repositories. It has a number of sub-commands with which you
|
||||
can manage your git configurations globally.
|
||||
|
||||
@deffn Sub-Command global
|
||||
Shows the template configuration as it would look in a git configuration
|
||||
file format. Since it does not operate on any repository no name
|
||||
substitution is performed.
|
||||
@end deffn
|
||||
|
||||
@deffn Sub-Command update [location]
|
||||
If @var{location} is specified, operate on it, otherwise operate on
|
||||
all registered repositories not in the exclusion list.
|
||||
|
||||
Merge the template configuration with each repository's existing
|
||||
configuration. This adds settings and sections that weren't there before
|
||||
and overwrites settings that were. This is a destructive operation, so
|
||||
be sure your settings are correct.
|
||||
@end deffn
|
||||
|
||||
@deffn Sub-Command hooks [location]
|
||||
If @var{location} is specified, operate on it, otherwise operate on
|
||||
all registered repositories not in the exclusion list.
|
||||
|
||||
Install the hooks specified in the configuration file into each
|
||||
repository. Each hook is a symlink to the configured executable.
|
||||
@end deffn
|
||||
@end deffn
|
||||
|
||||
In case you can't be bothered to go to whichever location you need to
|
||||
go to in order to push a repository, or have a bunch of repositories
|
||||
which all need a push, you can use the @command{push} command.
|
||||
|
||||
@deffn Command push [repository]
|
||||
Pushes all branches of all repositories to their default upstream by
|
||||
using
|
||||
|
||||
@example
|
||||
git push -all
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
on each registered repository. If @var{repository} has been specified,
|
||||
call it only on that repository.
|
||||
@end deffn
|
||||
|
||||
Lastly, if you're confused about gitto, you can use the @command{help}
|
||||
command, and if you forgot which version of gitto you were using you can
|
||||
use the @command{version} command.
|
||||
|
||||
@deffn Command help
|
||||
Shows a help message with a quick summary of all the available commands.
|
||||
@end deffn
|
||||
|
||||
@deffn Command version
|
||||
Shows the version of gitto.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Configuration, Copying This Manual, Usage, Top
|
||||
@chapter Configuration
|
||||
|
||||
gitto offers a few configuration options, mostly to do with git
|
||||
configuration management. The configuration is located at either
|
||||
@file{@env{XDG_CONFIG_HOME}/gitto/rc.scm} or
|
||||
@file{@env{HOME}/.config/gitto/rc.scm} depending on the existence of the
|
||||
@env{XDG_CONFIG_HOME} environment variable.
|
||||
|
||||
@defopt global-config
|
||||
An alist of alists representing sections, variables and values which
|
||||
will be placed in each git repository's configuration file. It looks
|
||||
like this:
|
||||
|
||||
@lisp
|
||||
((``@var{section}''
|
||||
(``@var{variable}'' . ``@var{value}'')
|
||||
(``@var{other-variable}'' ``@var{value1}'' ``@var{value2}'')))
|
||||
@end lisp
|
||||
|
||||
A variable specification can have more than one value, but since gitto
|
||||
doesn't know or care which variables can and cannot have more than one
|
||||
value in git, it is up to the user to make sure they only use it with
|
||||
supported variables.
|
||||
|
||||
Each value can have an @samp{~a} format specifier somewhere in their
|
||||
value, when merging configurations this will be replaced with the name
|
||||
of the repository for which the settings are being merged.
|
||||
|
||||
An example configuration could be:
|
||||
|
||||
@lisp
|
||||
(set! global-config
|
||||
'((``remote \''origin\''``
|
||||
(``url'' . ``git@@example.com:%a.git'')
|
||||
(``pushurl'' ``git@@example.com:%a.git''
|
||||
``git@@somehost.com:user/%a.git''))
|
||||
(``branch \''master\''``
|
||||
(``remote'' . ``origin''))))
|
||||
@end lisp
|
||||
|
||||
This example either modifies or creates the @samp{origin} remote in each
|
||||
repository, setting the @samp{url} and @samp{pushurl} value and then
|
||||
adding another @samp{pushurl} setting. It also creates or modifies the
|
||||
@samp{master} branch, setting its @samp{remote} to the @samp{ryuslash}
|
||||
remote.
|
||||
@end defopt
|
||||
|
||||
@defopt hook-alist
|
||||
An alist of @dfn{hook} and @dfn{executable} pairs. Each item in the list
|
||||
specifies a hook's name and the executable it should be linked to. An
|
||||
example configuration:
|
||||
|
||||
@lisp
|
||||
(set! hook-alist
|
||||
'((``commit-msg'' . ``/some/commit-msg/hook'')
|
||||
(``pre-commit'' . ``/some/pre-commit/hook'')))
|
||||
@end lisp
|
||||
|
||||
This will create symbolic links in the @file{.git/hooks} directories for
|
||||
each registered repository when calling @command{config hooks}. gitto
|
||||
doesn't know or care about which hooks exist, so it is up to the user to
|
||||
provide the correct names and look for typos.
|
||||
@end defopt
|
||||
|
||||
@defopt config-exclusion-list
|
||||
A plain list of repository names to skip when merging configurations and
|
||||
installing hooks.
|
||||
@end defopt
|
||||
|
||||
@defopt show-unchanged-branches?
|
||||
A boolean. If @code{#t} all branches will be shown no matter their
|
||||
state, if @code{#f} (the default) only those branches that either have
|
||||
commits to push or commits to pull will be shown in the output of the
|
||||
@samp{list} command.
|
||||
@end defopt
|
||||
|
||||
|
||||
@node Copying This Manual, Index, Configuration, Top
|
||||
@appendix Copying This Manual
|
||||
|
||||
@include fdl.texi
|
||||
|
||||
@node Index, , Copying This Manual, Top
|
||||
@unnumbered Index
|
||||
|
||||
@printindex fn
|
||||
@printindex vr
|
||||
|
||||
@bye
|
||||
|
||||
@c gitto.texi ends here
|
|
@ -1,10 +1,10 @@
|
|||
;;; gitto.el --- Gitto in emacs
|
||||
|
||||
;; Copyright (C) 2012 Tom Willemsen
|
||||
;; Copyright (C) 2012 Tom Willemse
|
||||
|
||||
;; Author: Tom Willemsen <thomas@aethon.nl>
|
||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||
;; Keywords: convenience
|
||||
;; Package-Version: 0.2.0
|
||||
;; Package-Version: 0.2.1
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +44,7 @@
|
|||
"Check if DIR is a registered repository."
|
||||
(not (string-match-p "not registered"
|
||||
(shell-command-to-string
|
||||
(concat gitto-program " -c " dir)))))
|
||||
(concat gitto-program " check " dir)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun gitto-register (dir)
|
||||
|
@ -53,7 +53,7 @@
|
|||
(unless dir
|
||||
(error "Not a git repository"))
|
||||
|
||||
(shell-command (concat gitto-program " -r " dir)))
|
||||
(shell-command (concat gitto-program " add " dir)))
|
||||
|
||||
;;;###autoload
|
||||
(defun gitto-unregister (dir)
|
||||
|
@ -62,7 +62,7 @@
|
|||
(unless (and dir (gitto-registered-p dir))
|
||||
(error "Not a registered git repository"))
|
||||
|
||||
(shell-command (concat gitto-program " -R " dir)))
|
||||
(shell-command (concat gitto-program " remove " dir)))
|
||||
|
||||
(provide 'gitto)
|
||||
;;; gitto.el ends here
|
||||
|
|
|
@ -3,28 +3,37 @@ SITEDIR = $(shell pkg-config guile-2.0 --variable=sitedir \
|
|||
--define-variable=prefix=$(DESTDIR))
|
||||
COMPDIR = $(DESTDIR)/lib/guile/2.0/site-ccache
|
||||
|
||||
objects = git.scm git.go main.scm main.go path.scm path.go
|
||||
objects = command.scm command.go config.scm config.go git.scm git.go \
|
||||
ui.scm ui.go path.scm path.go commands/help.scm commands/help.go \
|
||||
main.scm main.go
|
||||
install-objects = $(addprefix install-,$(objects))
|
||||
uninstall-objects = $(addprefix uninstall-,$(objects))
|
||||
|
||||
.PHONY: all install $(install-objects) uninstall $(uninstall-objects)
|
||||
warnings = unused-variable unused-toplevel unbound-variable \
|
||||
arity-mismatch duplicate-case-datum bad-case-datum format
|
||||
|
||||
.PHONY: all install $(install-objects) uninstall $(uninstall-objects) \
|
||||
clean
|
||||
|
||||
all: $(filter %.go,$(objects))
|
||||
|
||||
$(filter %.go,$(objects)): %.go: %.scm
|
||||
../env guild compile -o $@ $^
|
||||
../env guild compile $(addprefix -W ,$(warnings)) -o $@ $^
|
||||
|
||||
install: $(install-objects)
|
||||
uninstall: $(uninstall-objects)
|
||||
|
||||
$(filter %.go,$(install-objects)): install-%: $(filter %.go,$(objects))
|
||||
install -Dm 644 $* "$(COMPDIR)/gitto/$*"
|
||||
$(INSTALL_DATA) $* "$(COMPDIR)/gitto/$*"
|
||||
|
||||
$(filter %.scm,$(install-objects)): install-%:
|
||||
install -Dm 644 $* "$(SITEDIR)/gitto/$*"
|
||||
$(INSTALL_DATA) $* "$(SITEDIR)/gitto/$*"
|
||||
|
||||
$(filter %.go,$(uninstall-objects)): uninstall-%:
|
||||
rm -f "$(COMPDIR)/gitto/$*"
|
||||
|
||||
$(filter %.scm,$(uninstall-objects)): uninstall-%:
|
||||
rm -f "$(SITEDIR)/gitto/$*"
|
||||
|
||||
clean:
|
||||
rm -f *.go
|
||||
|
|
63
gitto/command.scm
Normal file
63
gitto/command.scm
Normal file
|
@ -0,0 +1,63 @@
|
|||
;; -*- coding: utf-8; -*-
|
||||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
;; gitto is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; gitto is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto command)
|
||||
#:export (define-command
|
||||
command?
|
||||
command-documentation
|
||||
command-function
|
||||
for-each-command))
|
||||
|
||||
(define-syntax define-command
|
||||
(syntax-rules ()
|
||||
((_ (name . args)
|
||||
usage
|
||||
longdoc
|
||||
exp exp* ...)
|
||||
(begin
|
||||
(set! command-list
|
||||
(cons
|
||||
(list (symbol->string (quote name))
|
||||
(cons
|
||||
#:function
|
||||
(case-lambda*
|
||||
(args
|
||||
exp exp* ...)
|
||||
(lst (format #t "Wrong number of arguments.~%"))))
|
||||
(cons #:usage usage)
|
||||
(cons #:documentation longdoc))
|
||||
command-list))))))
|
||||
|
||||
(define command-list '())
|
||||
|
||||
(define (command? name)
|
||||
"Check if NAME corresponds to a command."
|
||||
(not (null? (assoc-ref command-list name))))
|
||||
|
||||
(define (command-documentation command)
|
||||
"Get the documentation for COMMAND."
|
||||
(assq-ref (assoc-ref command-list command) #:documentation))
|
||||
|
||||
(define (command-function command)
|
||||
"Get the function for COMMAND."
|
||||
(assq-ref (assoc-ref command-list command) #:function))
|
||||
|
||||
(define (for-each-command function)
|
||||
"Execute FUNCTION for each known command."
|
||||
(for-each function command-list))
|
49
gitto/commands/help.scm
Normal file
49
gitto/commands/help.scm
Normal file
|
@ -0,0 +1,49 @@
|
|||
;; -*- coding: utf-8; -*-
|
||||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
;; gitto is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; gitto is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto commands help)
|
||||
#:use-module (gitto command)
|
||||
#:use-module (ice-9 format))
|
||||
|
||||
(define (print-command-help command)
|
||||
"Print the help message for COMMAND."
|
||||
(if (command? command)
|
||||
(format #t "~a~%" (command-documentation command))
|
||||
(format #t "Unknown command: ~a~%" command)))
|
||||
|
||||
(define (print-short-command-help command)
|
||||
"Print COMMAND's name and its short description."
|
||||
(format #t " ~a~15t~a~%" (car command) (assq-ref command #:usage)))
|
||||
|
||||
(define (print-general-help)
|
||||
"Print the general help message for gitto."
|
||||
(display "gitto [command [arguments ...]]")
|
||||
(newline)
|
||||
(for-each-command print-short-command-help))
|
||||
|
||||
(define-command (help #:optional command)
|
||||
"Display this help."
|
||||
"Usage: gitto help [COMMAND]
|
||||
|
||||
Display a help message. If COMMAND is not specified, print some
|
||||
information about gitto, otherwise print some information about
|
||||
COMMAND."
|
||||
(if command
|
||||
(print-command-help command)
|
||||
(print-general-help)))
|
152
gitto/config.scm
Normal file
152
gitto/config.scm
Normal file
|
@ -0,0 +1,152 @@
|
|||
;; -*- coding: utf-8; -*-
|
||||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
;; gitto is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; gitto is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto config)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 rdelim)
|
||||
#:export (global-config
|
||||
hook-alist
|
||||
|
||||
install-hooks
|
||||
merge-config
|
||||
read-config
|
||||
write-config))
|
||||
|
||||
(define global-config '())
|
||||
(define hook-alist '())
|
||||
|
||||
(define (install-hooks repo-location)
|
||||
"Install each hook in `hook-alist' into REPO-LOCATION."
|
||||
(for-each
|
||||
(lambda (hook)
|
||||
(let ((new-name (string-append repo-location "/.git/hooks/"
|
||||
(car hook))))
|
||||
(unless (file-exists? new-name)
|
||||
(symlink (cdr hook) new-name))))
|
||||
hook-alist))
|
||||
|
||||
(define (merge-config repo-name x y)
|
||||
"Merge configuration X with configuration Y.
|
||||
|
||||
The values in configuration Y will have `%a' substituted with
|
||||
REPO-NAME."
|
||||
(let ((lst (if x (list-copy x) '())))
|
||||
(for-each
|
||||
(lambda (s)
|
||||
(let ((b-sec (assoc (car s) lst)))
|
||||
(set! lst (assoc-set!
|
||||
lst (car s) (merge-settings
|
||||
repo-name (if b-sec (cdr b-sec) #f) (cdr s))))))
|
||||
y)
|
||||
lst))
|
||||
|
||||
(define (merge-setting repo-name lst var val)
|
||||
"Merge VAL into LST under VAR, substituting `%a' with REPO-NAME.
|
||||
|
||||
In case val is a list, all values in it have `%a' substituted with
|
||||
REPO-NAME."
|
||||
(if (list? val)
|
||||
(assoc-set! lst var (map (lambda (v) (format #f v repo-name)) val))
|
||||
(assoc-set! lst var (format #f val repo-name))))
|
||||
|
||||
(define (merge-settings repo-name x y)
|
||||
"Merge the settings in X with those in Y.
|
||||
|
||||
During merging values in Y will have `%a' substituted with REPO-NAME."
|
||||
(let ((lst (if x (list-copy x) '())))
|
||||
(for-each
|
||||
(lambda (v)
|
||||
(set! lst (merge-setting repo-name lst (car v) (cdr v))))
|
||||
y)
|
||||
lst))
|
||||
|
||||
(define (split-setting line)
|
||||
"Split LINE into a cons cell.
|
||||
|
||||
LINE should be a string which looks like `key=value'. The result is a
|
||||
cons cell with `(key . value)'."
|
||||
(let ((idx (string-index line #\=)))
|
||||
(cons (string-trim-both (substring line 0 idx))
|
||||
(string-trim-both (substring line (1+ idx))))))
|
||||
|
||||
(define (read-setting settings line)
|
||||
"Read and put the setting in LINE into SETTINGS.
|
||||
|
||||
LINE should be a string which looks like `key=value'. The result is
|
||||
SETTINGS with either the setting in LINE added to it, the current
|
||||
value of the variable specified in LINE overwritten with the value in
|
||||
LINE or the value in LINE appended to the existing variable in
|
||||
SETTINGS."
|
||||
(let* ((new-setting (split-setting line))
|
||||
(var (car new-setting)) (val (cdr new-setting))
|
||||
(current-value (assoc-ref settings var)))
|
||||
(if current-value
|
||||
(if (list? current-value)
|
||||
(assoc-set! settings var (append current-value (list val)))
|
||||
(assoc-set! settings var (list current-value val)))
|
||||
(assoc-set! settings var val))))
|
||||
|
||||
(define (read-config repo-location)
|
||||
"Read the configuration for the git repository at REPO-LOCATION.
|
||||
|
||||
This procedure returns an alist of `(SECTION-TITLE . SETTINGS)' cells
|
||||
where SETTINGS is an alist of `(VARIABLE . VALUE)' cells."
|
||||
(let ((port (open-input-file
|
||||
(string-append repo-location "/.git/config")))
|
||||
(config '())
|
||||
(current-section #f))
|
||||
(do ((line (read-line port) (read-line port)))
|
||||
((eof-object? line))
|
||||
(cond ((string= line "[" 0 1)
|
||||
(let ((section (cons (string-trim-both
|
||||
line (char-set #\[ #\])) '())))
|
||||
(set! config (append config (list section)))
|
||||
(set! current-section section)))
|
||||
((string-contains line "=")
|
||||
(set-cdr! current-section
|
||||
(read-setting (cdr current-section) line)))))
|
||||
(close-port port)
|
||||
config))
|
||||
|
||||
(define* (write-config config #:optional (file #f))
|
||||
(let ((thunk (lambda () (for-each write-section config))))
|
||||
(if file
|
||||
(with-output-to-file file thunk)
|
||||
(thunk))))
|
||||
|
||||
(define (write-section section)
|
||||
"Output SECTION as a git config section.
|
||||
|
||||
This prints SECTION's car as a section header and prints all the
|
||||
settings in SECTION's cdr."
|
||||
(format #t "[~a]~%" (car section))
|
||||
(for-each write-setting (cdr section)))
|
||||
|
||||
(define (write-setting setting)
|
||||
"Write SETTING to `standard-output'.
|
||||
|
||||
SETTING should be a cons cell or a proper list. In the case of it
|
||||
being a proper list a key=value line will be printed for each item in
|
||||
the cdr of SETTING. In case of a cons cell where the cdr isn't a list
|
||||
just one line will be printed."
|
||||
(let ((value (cdr setting)))
|
||||
(if (list? value)
|
||||
(map (lambda (v)
|
||||
(format #t "~8t~a = ~a~%" (car setting) v)) value)
|
||||
(format #t "~8t~a = ~a~%" (car setting) (cdr setting)))))
|
|
@ -1,6 +1,6 @@
|
|||
;; -*- coding: utf-8; -*-
|
||||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
|||
#:use-module (ice-9 popen)
|
||||
#:use-module (ice-9 rdelim)
|
||||
#:use-module (oop goops)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:export (<branch>
|
||||
<repository>
|
||||
|
||||
|
@ -30,13 +31,21 @@
|
|||
branch-pushable
|
||||
branch-updated
|
||||
git-dir?
|
||||
git-push
|
||||
print
|
||||
repo-branches
|
||||
repo-clean?
|
||||
repo-location
|
||||
repo-name
|
||||
repository?
|
||||
repository-location<?
|
||||
repository-location-exists?
|
||||
repository-name<?
|
||||
repository-name=?
|
||||
same-repository?))
|
||||
|
||||
(define show-unchanged-branches? #f)
|
||||
|
||||
(define-generic print)
|
||||
(define-generic same-repository?)
|
||||
|
||||
|
@ -52,6 +61,25 @@
|
|||
(clean? #:getter repo-clean?)
|
||||
(branches #:getter repo-branches))
|
||||
|
||||
(define (repository? repo)
|
||||
(is-a? repo <repository>))
|
||||
|
||||
(define (repository-location<? repo1 repo2)
|
||||
"Compary REPO1 and REPO2 to see if REPO1 should be considered less."
|
||||
(string<? (repo-location repo1) (repo-location repo2)))
|
||||
|
||||
(define (repository-location-exists? repo)
|
||||
"Check to see if REPO's location exists."
|
||||
(file-exists? (repo-location repo)))
|
||||
|
||||
(define (repository-name<? repo1 repo2)
|
||||
"Compare REPO1 and REPO2 to see if REPO1 should be considered less."
|
||||
(string<? (repo-name repo1) (repo-name repo2)))
|
||||
|
||||
(define (repository-name=? repo name)
|
||||
"Company the name of REPO1 to NAME and determine equality."
|
||||
(string= (repo-name repo) name))
|
||||
|
||||
(define-method (branch-pullable (branch <branch>))
|
||||
(force (slot-ref branch 'pullable)))
|
||||
|
||||
|
@ -62,21 +90,27 @@
|
|||
(force (slot-ref branch 'updated)))
|
||||
|
||||
(define (git-branches dir)
|
||||
"Call git-branch and parse its output."
|
||||
(let ((pipe (start-git dir "branch")))
|
||||
(map
|
||||
(lambda (b) (string-trim-both b (char-set #\* #\space)))
|
||||
(string-split (string-trim-right (read-string pipe)) #\newline))))
|
||||
|
||||
(define (git-clean? dir)
|
||||
"Check whether a repository is clean, meaning there are no changes
|
||||
to the tracked files. Utracked files will not register."
|
||||
"Check whether a repository is clean.
|
||||
|
||||
Clean means there are no changes to the tracked files. Untracked files
|
||||
will not register."
|
||||
(let* ((pipe (start-git dir "status -suno"))
|
||||
(clean? (eof-object? (read-delimited "" pipe))))
|
||||
(close-pipe pipe)
|
||||
clean?))
|
||||
|
||||
(define (git-dir? dir)
|
||||
"Check whether or not DIR/.git exists."
|
||||
"Check whether or not DIR is a git repository.
|
||||
|
||||
DIR will be considered a git repository if it has a `.git'
|
||||
sub-directory."
|
||||
(let ((dir (string-append dir "/.git")))
|
||||
(if (file-exists? dir)
|
||||
(let ((dirstat (stat dir)))
|
||||
|
@ -84,7 +118,7 @@ to the tracked files. Utracked files will not register."
|
|||
#f)))
|
||||
|
||||
(define (git-last-update dir branch)
|
||||
"Check when the last update upstream was."
|
||||
"Check when the last update in DIR of upstream for BRANCH was."
|
||||
(let* ((pipe (start-git
|
||||
dir (format #f "log -1 --format=%ar ~a@{u}" branch)))
|
||||
(relative-last-update (read-line pipe)))
|
||||
|
@ -111,6 +145,12 @@ to the tracked files. Utracked files will not register."
|
|||
(close-pipe pipe)
|
||||
num))
|
||||
|
||||
(define (git-push repository)
|
||||
"Try to push REPOSITORY to its default upstream."
|
||||
(let* ((pipe (start-git (repo-location repository)
|
||||
(format #f "push --all"))))
|
||||
(close-pipe pipe)))
|
||||
|
||||
(define-method (initialize (branch <branch>) args)
|
||||
(let ((name (car args))
|
||||
(dir (cadr args)))
|
||||
|
@ -130,17 +170,29 @@ to the tracked files. Utracked files will not register."
|
|||
(git-branches dir))))))
|
||||
|
||||
(define-method (print (branch <branch>))
|
||||
(format #t " ~a:~15t~d to push and ~d to pull. Last update: ~a~%"
|
||||
(branch-name branch) (branch-pushable branch)
|
||||
(branch-pullable branch) (branch-updated branch)))
|
||||
(let ((pushable (branch-pushable branch))
|
||||
(pullable (branch-pullable branch)))
|
||||
(if (or show-unchanged-branches?
|
||||
(> (+ pushable pullable) 0))
|
||||
(format #t " ~a:~15t~d to push and ~d to pull. Last update: ~a~%"
|
||||
(branch-name branch) pushable pullable
|
||||
(branch-updated branch))
|
||||
#f)))
|
||||
|
||||
(define (repo-state-description repo)
|
||||
"Return the state of REPO as either clean or dirty.
|
||||
|
||||
REPO should be of type `<repository>' and the result is a string."
|
||||
(if (repo-clean? repo) "clean" "dirty"))
|
||||
|
||||
(define-method (print (repo <repository>))
|
||||
(if (file-exists? (repo-location repo))
|
||||
(begin
|
||||
(format #t "~a: Worktree is ~a~%" (repo-name repo)
|
||||
(if (repo-clean? repo) "clean" "dirty"))
|
||||
(for-each print (repo-branches repo))
|
||||
(newline))
|
||||
(repo-state-description repo))
|
||||
(when (any identity (map-in-order print (repo-branches repo)))
|
||||
(newline))
|
||||
#t)
|
||||
(format #t "~a:~15tnot found at ~s\n"
|
||||
(repo-name repo) (repo-location repo))))
|
||||
|
||||
|
@ -159,6 +211,9 @@ to the tracked files. Utracked files will not register."
|
|||
(define-method (same-repository? (x <string>) (y <repository>))
|
||||
(string= x (repo-location y)))
|
||||
|
||||
(define-method (same-repository? x y)
|
||||
#f)
|
||||
|
||||
(define* (start-git dir args #:optional (extra ""))
|
||||
(open-input-pipe
|
||||
(format #f "git --work-tree=~s --git-dir=\"~a/.git\" ~a 2>/dev/null ~a"
|
||||
|
|
432
gitto/main.scm
432
gitto/main.scm
|
@ -1,6 +1,6 @@
|
|||
;; -*- coding: utf-8; -*-
|
||||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
|
@ -18,157 +18,160 @@
|
|||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto main)
|
||||
#:use-module (gitto command)
|
||||
#:use-module (gitto commands help)
|
||||
#:use-module (gitto config)
|
||||
#:use-module (gitto git)
|
||||
#:use-module (gitto path)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 getopt-long)
|
||||
#:use-module (gitto ui)
|
||||
#:use-module (ice-9 popen)
|
||||
#:use-module (oop goops)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:export (main))
|
||||
|
||||
(define (canonicalize-filename path)
|
||||
"Get a canonicalized name for PATH, unless it's already familiar."
|
||||
(if (member path repositories same-repository?)
|
||||
path
|
||||
(realpath path)))
|
||||
|
||||
(define (config-dir) (storage-dir "XDG_CONFIG_HOME" "/.config"))
|
||||
|
||||
(define (config-file file) (string-append (config-dir) "/" file))
|
||||
|
||||
(define (data-dir) (storage-dir "XDG_DATA_HOME" "/.local/share"))
|
||||
|
||||
(define (data-file file) (string-append (data-dir) "/" file))
|
||||
|
||||
(define (known? repo)
|
||||
"Do we know REPO?"
|
||||
(and (valid-repo? repo) (registered? repo)))
|
||||
|
||||
(define (list-repository-locations)
|
||||
"List the registered locations of repositories."
|
||||
(for-each print-repository-location
|
||||
(sort repositories repository-location<?)))
|
||||
|
||||
(define (load-rc)
|
||||
"Load the RC file for user customizations."
|
||||
(let ((cfg (config-file "rc.scm")))
|
||||
(when (file-exists? cfg)
|
||||
(save-module-excursion
|
||||
(lambda ()
|
||||
(set-current-module (resolve-module '(gitto main)))
|
||||
(primitive-load cfg))))))
|
||||
|
||||
(define (maybe-install-hooks. repo)
|
||||
"Install hooks for REPO unless it's excluded."
|
||||
(unless (member (repo-name repo) config-exclusion-list)
|
||||
(install-hooks (repo-location repo))))
|
||||
|
||||
(define (print-config repo)
|
||||
"Print the configuration for REPO."
|
||||
(display (string-upcase (repo-name repo)))
|
||||
(newline)
|
||||
(write-config (read-config (repo-location repo)))
|
||||
(newline)
|
||||
(newline))
|
||||
|
||||
(define (print-repository-location repo)
|
||||
"Print the location of REPO."
|
||||
(display (repo-location repo))
|
||||
(newline))
|
||||
|
||||
(define (registered? repo)
|
||||
"Check if REPO has been registered."
|
||||
(or (member repo repositories same-repository?)
|
||||
(member (realpath (if (string? repo)
|
||||
repo
|
||||
(repo-location repo)))
|
||||
repositories same-repository?)))
|
||||
|
||||
(define (remove-one-repository repos)
|
||||
"Remove one repository from those in REPOS.
|
||||
|
||||
In case REPOS only contains one repository, remove it. Otherwise ask
|
||||
the user to choose one and remove the chosen repository."
|
||||
(if (> (length repos) 1)
|
||||
(let* ((prompt
|
||||
"Which of the following repositories would you like to remove?")
|
||||
(location (repo-location (choose repos prompt repo-location))))
|
||||
(when location (remove-repository-by-location location)))
|
||||
(remove-repository-by-location (repo-location (car repos)))))
|
||||
|
||||
(define (remove-repository repository)
|
||||
"Remove REPOSITORY from the list of known repositories."
|
||||
(set! repositories
|
||||
(delete repository repositories same-repository?))
|
||||
(save-repositories-list))
|
||||
|
||||
(define (remove-repository-by-location location)
|
||||
"Look for a repository in LOCATION and try to remove it."
|
||||
(set! location (canonicalize-filename location))
|
||||
|
||||
(if (known? location)
|
||||
(begin
|
||||
(remove-repository location)
|
||||
(simple-format #t "Repository ~A removed." location))
|
||||
(display "Not a registered repository."))
|
||||
(newline))
|
||||
|
||||
(define (repositories-by-name name)
|
||||
"Get the repositories identified by NAME."
|
||||
(filter (lambda (repo) (repository-name=? repo name)) repositories))
|
||||
|
||||
(define (save-repositories-list)
|
||||
"Save the list of repositories."
|
||||
(ensure-directory-exists. (data-dir))
|
||||
;; Sort first
|
||||
(set! repositories (sort repositories repository-name<?))
|
||||
(write-repositories!))
|
||||
|
||||
(define (show-global-config)
|
||||
"Show the template specified in `global-config'."
|
||||
(write-config global-config))
|
||||
|
||||
(define (storage-dir xdg-env fallback)
|
||||
"Get the location where gitto stores information.
|
||||
|
||||
XDG-ENV specifies which XDG environment variable should be looked at
|
||||
and FALLBACK specifies the directory to use if XDG-ENV has not been
|
||||
set in the current environment."
|
||||
(let ((xdg (getenv xdg-env)))
|
||||
(string-append
|
||||
(or xdg (getenv "HOME")) (if xdg "" fallback) "/gitto")))
|
||||
|
||||
(define (config-dir) (storage-dir "XDG_CONFIG_HOME" "/.config"))
|
||||
(define (config-file file) (string-append (config-dir) "/" file))
|
||||
(define (data-dir) (storage-dir "XDG_DATA_HOME" "/.local/share"))
|
||||
(define (data-file file) (string-append (data-dir) "/" file))
|
||||
(define* (update-config #:optional repo)
|
||||
"Merge the configured configuration with all repositories."
|
||||
(if repo
|
||||
(if (known? repo)
|
||||
(update-repo-config (make <repository> repo))
|
||||
(format #t "Unknown repository: ~a~%" repo))
|
||||
(for-each update-repo-config repositories)))
|
||||
|
||||
(define (version)
|
||||
"Display version information."
|
||||
(display "gitto 0.1.0") (newline)
|
||||
(display "Copyright (C) 2012 Tom Willemsen") (newline)
|
||||
(display "This program comes with ABSOLUTELY NO WARRANTY.") (newline)
|
||||
(display "You may redistribute copies of this program") (newline)
|
||||
(display "under the terms of the GNU General Public License.") (newline)
|
||||
(display "For more information about these matters, see the file named COPYING.") (newline))
|
||||
(define (update-repo-config repo)
|
||||
"Merge the configured configuration with REPO's configuration.
|
||||
|
||||
(define (help)
|
||||
"Display some help."
|
||||
(display "\
|
||||
gitto [options]
|
||||
-r, --register REPO Register a new repository directory
|
||||
-R, --remove REPO Remove a repository directory
|
||||
-l, --repositories List all registered repositories' locations
|
||||
-p, --purge Remove all repositories that don't exist
|
||||
-v, --version Display version
|
||||
-h, --help Display this help
|
||||
"))
|
||||
Don't do anything if REPO has been added to `config-exclusion-list'."
|
||||
(unless (member (repo-name repo) config-exclusion-list)
|
||||
(write-config
|
||||
(merge-config (repo-name repo)
|
||||
(read-config (repo-location repo))
|
||||
global-config)
|
||||
(string-append (repo-location repo) "/.git/config"))))
|
||||
|
||||
(define (known? repo)
|
||||
"Do we know REPO?"
|
||||
(or (member repo repositories same-repository?)
|
||||
(member (realpath (if (string? repo) repo (repo-location repo)))
|
||||
repositories same-repository?)))
|
||||
|
||||
(define (save-repositories-list)
|
||||
"Save the list of repositories."
|
||||
(let ((dir (data-dir)))
|
||||
(unless (file-exists? dir)
|
||||
(mkdir dir)))
|
||||
|
||||
;; Sort first
|
||||
(set! repositories
|
||||
(sort repositories
|
||||
(lambda (s1 s2)
|
||||
(string<? (repo-name s1) (repo-name s2)))))
|
||||
(define (valid-repo? repo)
|
||||
"Check if REPO is or could be made usable as a repository."
|
||||
(or (repository? repo) (string? repo)))
|
||||
|
||||
(define (write-repositories!)
|
||||
"Write the repositories to the repositories file."
|
||||
(let ((port (open-output-file repositories-file))
|
||||
(repos (map repo-location repositories)))
|
||||
(write repos port)
|
||||
(close-port port)))
|
||||
|
||||
(define (repository-registered? repository)
|
||||
"Check to see if REPOSITORY has been registered."
|
||||
(format #t "Repository is~a registered~%"
|
||||
(if (known? repository) "" " not")))
|
||||
|
||||
(define (register-repository repository)
|
||||
"Register REPOSITORY in the repository list."
|
||||
(set! repository (make <repository> (realpath repository)))
|
||||
(if (not (known? repository))
|
||||
(begin
|
||||
(set! repositories (append `(,repository) repositories))
|
||||
(save-repositories-list)
|
||||
(simple-format #t "Repository ~A registered."
|
||||
(repo-name repository)))
|
||||
(display "Repository already registered."))
|
||||
(newline))
|
||||
|
||||
(define (remove-repository repository)
|
||||
"Remove/unregister REPOSITORY from the repository list."
|
||||
(unless (member repository repositories same-repository?)
|
||||
(set! repository (realpath repository)))
|
||||
|
||||
(if (known? repository)
|
||||
(begin
|
||||
(set! repositories
|
||||
(delete repository repositories same-repository?))
|
||||
(save-repositories-list)
|
||||
(simple-format #t "Repository ~A removed." repository))
|
||||
(display "Not a registered repository."))
|
||||
(newline))
|
||||
|
||||
(define (list-repositories)
|
||||
"List information about every repository."
|
||||
(for-each print repositories))
|
||||
|
||||
(define (list-repository-locations)
|
||||
"List the registered locations of repositories."
|
||||
(for-each
|
||||
(lambda (repo)
|
||||
(display (repo-location repo))
|
||||
(newline))
|
||||
(sort repositories
|
||||
(lambda (s1 s2)
|
||||
(string<? (repo-location s1) (repo-location s2))))))
|
||||
|
||||
(define (purge)
|
||||
"Purge all items from the list that can no longer be found."
|
||||
(set! repositories
|
||||
(filter (lambda (repo)
|
||||
(file-exists? (repo-location repo)))
|
||||
repositories))
|
||||
(save-repositories-list))
|
||||
|
||||
(define option-spec
|
||||
`((version (single-char #\v))
|
||||
(help (single-char #\h))
|
||||
(register (single-char #\r) (value #t) (predicate ,git-dir?))
|
||||
(remove (single-char #\R) (value #t) (predicate ,known?))
|
||||
(repositories (single-char #\l))
|
||||
(purge (single-char #\p))
|
||||
(check (single-char #\c) (value #t))))
|
||||
|
||||
(define (main args)
|
||||
"Parse the command line options and run the appropriate functions."
|
||||
(let* ((options (getopt-long args option-spec))
|
||||
(help-wanted? (option-ref options 'help #f))
|
||||
(version-wanted? (option-ref options 'version #f))
|
||||
(registration-needed? (option-ref options 'register #f))
|
||||
(removal? (option-ref options 'remove #f))
|
||||
(list? (option-ref options 'repositories #f))
|
||||
(purge? (option-ref options 'purge #f))
|
||||
(check? (option-ref options 'check #f))
|
||||
(cfg (config-file "rc.scm")))
|
||||
(when (file-exists? cfg)
|
||||
(save-module-excursion
|
||||
(lambda ()
|
||||
(set-current-module (resolve-module '(gitto main)))
|
||||
(primitive-load cfg))))
|
||||
|
||||
(cond (version-wanted? (version))
|
||||
(help-wanted? (help))
|
||||
(registration-needed? => register-repository)
|
||||
(removal? => remove-repository)
|
||||
(list? (list-repository-locations))
|
||||
(purge? (purge))
|
||||
(check? => repository-registered?)
|
||||
(#t (list-repositories)))))
|
||||
|
||||
(define config-exclusion-list '())
|
||||
(define repositories-file (data-file "repos.scm"))
|
||||
|
||||
(define repositories
|
||||
|
@ -178,3 +181,170 @@ gitto [options]
|
|||
(close-port port)
|
||||
(map-in-order (lambda (repo) (make <repository> repo)) result))
|
||||
'()))
|
||||
|
||||
(define-command (add repository)
|
||||
"Register a repository."
|
||||
"Usage: gitto add REPO
|
||||
|
||||
Add REPO to the registered repository list. This command will fail if
|
||||
REPO does not indicate a git repository or if it has already been
|
||||
registered."
|
||||
(set! repository (make <repository> (realpath repository)))
|
||||
(if (not (known? repository))
|
||||
(begin
|
||||
(set! repositories (append `(,repository) repositories))
|
||||
(save-repositories-list)
|
||||
(simple-format #t "Repository ~A registered.~%"
|
||||
(repo-name repository))
|
||||
|
||||
;; Ask the user if they would like to merge their config
|
||||
;; template with the newly registered repository if they have
|
||||
;; a configuration set-up and the current input port is a tty.
|
||||
(when (and (isatty? (current-input-port))
|
||||
(not (eq? global-config '()))
|
||||
(y-or-n? "Would you like to merge your settings?"
|
||||
#:default #t))
|
||||
(update-repo-config repository)))
|
||||
(display "Repository already registered."))
|
||||
(newline))
|
||||
|
||||
(define-command (check repository)
|
||||
"Check to see if a repository has been registered."
|
||||
"Usage: gitto check REPO
|
||||
|
||||
Checks whether or not the git repository REPO has been registered with
|
||||
gitto."
|
||||
(format #t "Repository is~a registered~%"
|
||||
(if (known? repository) "" " not")))
|
||||
|
||||
(define-command (config #:optional sub repository)
|
||||
"Manage your repositories' configurations."
|
||||
"Usage: gitto config
|
||||
gitto config global
|
||||
gitto config update [repository]
|
||||
|
||||
The first form prints the configurations for each registered
|
||||
repository.
|
||||
|
||||
The second form shows what your configured configuration template
|
||||
looks like as a git configuration file. This does not expand the `%a'
|
||||
format specifier which can be used to indicate the repository name.
|
||||
|
||||
The third form merges the template in and existing configurations,
|
||||
overwriting settings when necessary. The repositories in the
|
||||
`config-exclusion-list' will be skipped. If REPOSITORY is specified it
|
||||
only updates the configuration for that repository. *Note:* This is a
|
||||
destructive operation, you should be mindful."
|
||||
(cond
|
||||
((not sub) (for-each print-config repositories))
|
||||
((equal? sub "global") (show-global-config))
|
||||
((equal? sub "update") (update-config repository))))
|
||||
|
||||
(define-command (hooks #:optional sub repository)
|
||||
"Manage your repositories' hooks."
|
||||
"Usage: gitto hooks init [repository]
|
||||
|
||||
Installs the configured hooks into each repository or the given
|
||||
repository."
|
||||
(cond
|
||||
((equal? sub "init")
|
||||
(if repository
|
||||
(if (known? repository)
|
||||
(maybe-install-hooks. (make <repository> repository))
|
||||
(format #t "Unknown repository: ~a~%" repository))
|
||||
(for-each maybe-install-hooks. repositories)))))
|
||||
|
||||
(define-command (list . args)
|
||||
"List information about every repository."
|
||||
"Usage: gitto list
|
||||
gitto list locations
|
||||
|
||||
The first form shows an overview of the status of your registered
|
||||
repositories and their branches. By default branches without changer
|
||||
aren't shown, but you can change this behaviour by setting the
|
||||
`show-unchanged-branches?' variable in your init file.
|
||||
|
||||
The second form prints the location on your filesystem for each
|
||||
registered repository as absolute paths."
|
||||
(if (and (not (eq? args '())) (equal? (car args) "locations"))
|
||||
(list-repository-locations)
|
||||
(for-each print repositories)))
|
||||
|
||||
(define-command (purge)
|
||||
"Purge all registered repositories that can no longer be found."
|
||||
"Usage: gitto purge
|
||||
|
||||
Go through the list of registered repositories and remove all the ones
|
||||
which no longer point to a git repository."
|
||||
(set! repositories (filter repository-location-exists? repositories))
|
||||
(save-repositories-list))
|
||||
|
||||
(define-command (push #:optional repository)
|
||||
"Push all or the specified repository to its default upstream."
|
||||
"Usage: gitto push [repository]
|
||||
|
||||
Go through the list of registered repositories and push all the ones
|
||||
with changes to their default upstream. If REPOSITORY has been
|
||||
specified just try to push that repository regardless of status."
|
||||
(define (push-and-report repo)
|
||||
(if (git-push repo)
|
||||
(format #t "Succesfully pushed ~a~%" (repo-name repo))
|
||||
(format #f "Pushing ~a failed~%" (repo-name repo))))
|
||||
|
||||
(if repository
|
||||
(let* ((repositories-by-name (repositories-by-name repository))
|
||||
(results (length repositories-by-name))
|
||||
(repo #f))
|
||||
(when (> results 0)
|
||||
(set! repo
|
||||
(if (= results 1)
|
||||
(car repositories-by-name)
|
||||
(choose repositories-by-name
|
||||
"Push to which repository?" repo-location))))
|
||||
|
||||
(if (or (> results 0) (known? repository))
|
||||
(push-and-report (or repo (make <repository> repository)))
|
||||
(format #t "Unknown repository: ~a~%" repository)))
|
||||
(for-each push-and-report repositories)))
|
||||
|
||||
(define-command (remove repository)
|
||||
"Unregister a repository."
|
||||
"Usage: gitto remove REPO
|
||||
|
||||
Removes REPO from the registered repository list. This command will
|
||||
fail if REPO does not indicate a git repository of if it hasn't been
|
||||
registered.
|
||||
|
||||
REPO should either be the name of a repository as displayed by the
|
||||
`list' command, or should be a absolute or relative path to a
|
||||
registered location. In case REPO is just a name and there is more
|
||||
than one repository with that name you are given a choice between the
|
||||
possible options."
|
||||
(let ((results (repositories-by-name repository)))
|
||||
(if (null? results)
|
||||
(remove-repository-by-location repository)
|
||||
(remove-one-repository results))))
|
||||
|
||||
(define-command (version)
|
||||
"Display version information."
|
||||
"Usage: gitto version
|
||||
|
||||
Displays version and some copyright information."
|
||||
(display "gitto 0.1.0") (newline)
|
||||
(display "Copyright (C) 2012 Tom Willemse") (newline)
|
||||
(display "This program comes with ABSOLUTELY NO WARRANTY.") (newline)
|
||||
(display "You may redistribute copies of this program") (newline)
|
||||
(display "under the terms of the GNU General Public License.") (newline)
|
||||
(display "For more information about these matters, see the file named COPYING.") (newline))
|
||||
|
||||
(define (main args)
|
||||
"Parse the command line options and run the appropriate functions."
|
||||
(load-rc)
|
||||
|
||||
(let* ((command-spec (cdr (member "gitto" args string-suffix?)))
|
||||
(command-specified? (not (eq? command-spec '())))
|
||||
(command (car (if command-specified? command-spec '("list")))))
|
||||
(if (command? command)
|
||||
(apply (command-function command)
|
||||
(if command-specified? (cdr command-spec) '()))
|
||||
(format #t "Unknown command: ~a~%" (car command-spec)))))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
|
@ -17,6 +17,15 @@
|
|||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto path)
|
||||
#:export (realpath))
|
||||
#:export (realpath
|
||||
ensure-directory-exists.))
|
||||
|
||||
(load-extension "libguile-gitto-path" "init_gitto")
|
||||
|
||||
(define (ensure-directory-exists. path)
|
||||
"Make sure PATH exists.
|
||||
|
||||
Check if PATH exists, and if so do nothing. If PATH doesn't exist,
|
||||
create it."
|
||||
(unless (file-exists? path)
|
||||
(mkdir path)))
|
||||
|
|
62
gitto/ui.scm
Normal file
62
gitto/ui.scm
Normal file
|
@ -0,0 +1,62 @@
|
|||
;; gitto -- Keep track of your git repositories
|
||||
;; Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
;; This file is part of gitto.
|
||||
|
||||
;; gitto is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; gitto is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gitto ui)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 i18n)
|
||||
#:use-module (ice-9 rdelim)
|
||||
#:export (y-or-n?
|
||||
choose))
|
||||
|
||||
(define* (y-or-n? prompt #:key (default #f))
|
||||
(format #t "~a [~a] " prompt (if default "Y/n" "y/N"))
|
||||
(let ((char (read-char)))
|
||||
|
||||
;; Clear the rest of the input buffer.
|
||||
(unless (eq? char #\newline)
|
||||
(read-line))
|
||||
|
||||
(case char
|
||||
((#\y #\Y #\newline) #t)
|
||||
((#\n #\N) #f)
|
||||
(else
|
||||
(display "Invalid response, please use `y' or `n'.")
|
||||
(newline)
|
||||
(y-or-n? prompt #:default default)))))
|
||||
|
||||
(define* (choose collection prompt #:optional (key identity))
|
||||
"Ask the user to choose one of COLLECTION.
|
||||
|
||||
PROMPT is the question to ask the user and KEY is the function to use
|
||||
to present the options to the user."
|
||||
(format #t "~a~%~%Choose one:~%~%" prompt)
|
||||
|
||||
(do ((idx 1 (1+ idx))
|
||||
(cll collection (cdr cll)))
|
||||
((null? cll))
|
||||
(format #t "~3d. ~a~%" idx (key (car cll))))
|
||||
|
||||
(newline)
|
||||
(display "Your Choice: ")
|
||||
|
||||
(let ((response (locale-string->integer (read-line))))
|
||||
(if (and response (<= 1 response (length collection)))
|
||||
(list-ref collection (1- response))
|
||||
(begin
|
||||
(format #t "Improper response.~%")
|
||||
(choose collection prompt key)))))
|
1
site/.gitignore
vendored
Normal file
1
site/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
_publish/
|
17
site/Makefile
Normal file
17
site/Makefile
Normal file
|
@ -0,0 +1,17 @@
|
|||
.PHONY: export publish
|
||||
|
||||
all:
|
||||
|
||||
export: manual
|
||||
emacs -batch -l project.el -f org-publish-all
|
||||
|
||||
publish: export
|
||||
rsync -avuz --delete --exclude='*~' _publish/ \
|
||||
ryuslash.org:public_html/orgweb/projects/gitto
|
||||
|
||||
manual:
|
||||
$(MAKE) -C "$(CURDIR)"/../doc html
|
||||
|
||||
clean:
|
||||
rm -f *.elc
|
||||
rm -rf _publish
|
21
site/index.org
Normal file
21
site/index.org
Normal file
|
@ -0,0 +1,21 @@
|
|||
#+TITLE: gitto
|
||||
#+HTML_LINK_HOME: http://ryuslash.org
|
||||
#+OPTIONS: num:nil toc:nil author:nil
|
||||
#+STARTUP: showall
|
||||
#+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
|
||||
|
||||
#+BEGIN_CENTER
|
||||
[[http://code.ryuslash.org/cgit.cgi/gitto/][Browse source]]
|
||||
[[http://blog.ryuslash.org/tags/gitto][Read posts]]
|
||||
Dowlnoad: [[http://code.ryuslash.org/cgit.cgi/gitto/snapshot/gitto-master.tar.gz][TAR.GZ]], [[http://code.ryuslash.org/cgit.cgi/gitto/snapshot/gitto-master.zip][ZIP]]
|
||||
#+END_CENTER
|
||||
|
||||
#+INCLUDE: "../README.org"
|
||||
|
||||
* INSTALLING
|
||||
|
||||
#+INCLUDE: "../INSTALL" :minlevel 2
|
||||
|
||||
* CONTRIBUTING
|
||||
|
||||
#+INCLUDE: "../CONTRIBUTING" :minlevel 2
|
23
site/project.el
Normal file
23
site/project.el
Normal file
|
@ -0,0 +1,23 @@
|
|||
(require 'org-publish)
|
||||
|
||||
(setq org-publish-project-alist
|
||||
'(("gitto-docs"
|
||||
:base-directory "../doc/html"
|
||||
:publishing-directory "_publish/manual"
|
||||
:recursive t
|
||||
:base-extension "html"
|
||||
:publishing-function org-publish-attachment)
|
||||
("gitto-files"
|
||||
:base-directory "./"
|
||||
:publishing-directory "_publish/"
|
||||
:recursive nil
|
||||
:base-extension "css"
|
||||
:publishing-function org-publish-attachment)
|
||||
("gitto-org"
|
||||
:base-directory "./"
|
||||
:publishing-directory "_publish"
|
||||
:recursive nil
|
||||
:base-extension "org"
|
||||
:publishing-function org-publish-org-to-html)
|
||||
("gitto-site"
|
||||
:components ("gitto-org" "gitto-files"))))
|
68
site/stylesheet.css
Normal file
68
site/stylesheet.css
Normal file
|
@ -0,0 +1,68 @@
|
|||
a
|
||||
{
|
||||
color: #6d97bf;
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: #b27dbf;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
font-family: "DejaVu Sans", sans-serif;
|
||||
background-color: #222224;
|
||||
color: #eeeeec;
|
||||
}
|
||||
|
||||
code,
|
||||
pre
|
||||
{
|
||||
font-family: "Envy Code R", monospace;
|
||||
}
|
||||
|
||||
h3, h4,
|
||||
.outline-text-2,
|
||||
.outline-text-3,
|
||||
.outline-text-4
|
||||
{
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
pre
|
||||
{
|
||||
background-color: #111113;
|
||||
color: #eeeeec;
|
||||
border: 1px solid #a5a5a4;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
ul
|
||||
{
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
#content
|
||||
{
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
#org-div-home-and-up
|
||||
{
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
#postamble
|
||||
{
|
||||
font-size: 12px;
|
||||
padding: 3px 5px;
|
||||
border: 1px solid #a5a5a4;
|
||||
width: 690px;
|
||||
}
|
||||
|
||||
#postamble p
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1.3em;
|
||||
}
|
14
src/Makefile
14
src/Makefile
|
@ -1,12 +1,14 @@
|
|||
DESTDIR ?= /usr/local
|
||||
CFLAGS = $(shell pkg-config --cflags guile-2.0) -fPIC
|
||||
LDFLAGS = $(shell pkg-config --libs guile-2.0)
|
||||
EXTDIR = $(shell pkg-config guile-2.0 --variable=extensiondir \
|
||||
--define-variable=prefix=$(DESTDIR))
|
||||
|
||||
objects = gitto-path.o
|
||||
|
||||
all: libguile-gitto-path.so
|
||||
|
||||
.PHONY: install uninstall
|
||||
.PHONY: install uninstall clean
|
||||
|
||||
%.x: %.c
|
||||
guile-snarf -o $@ $< $(CFLAGS)
|
||||
|
@ -16,12 +18,14 @@ libguile-gitto-path.so: gitto-path.o
|
|||
$(CC) $(CFLAGS) -shared -o libguile-gitto-path.so $^
|
||||
|
||||
install-gitto: gitto
|
||||
install -Dm 755 $^ ${DESTDIR}/bin/$^
|
||||
$(INSTALL_PROGRAM) -m 755 $^ ${DESTDIR}/bin/$^
|
||||
install-libguile-gitto-path: libguile-gitto-path.so
|
||||
install -Dm 755 $^ \
|
||||
$(shell pkg-config guile-2.0 --variable=extensiondir)/$^
|
||||
$(INSTALL_PROGRAM) -m 755 $^ ${EXTDIR}/$^
|
||||
install: install-gitto install-libguile-gitto-path
|
||||
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}/bin/gitto
|
||||
rm -f $(shell pkg-config guile-2.0 --variable=extensiondir)/libguile-gitto-path.so
|
||||
rm -f ${EXTDIR}/libguile-gitto-path.so
|
||||
|
||||
clean:
|
||||
rm -f *.o *.x *.so
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# gitto -- Keep track of your git repositories
|
||||
# Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||
# Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
# This file is part of gitto.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* gitto -- Keep track of your git repositories
|
||||
Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||
Copyright (C) 2012 Tom Willemse <tom at ryuslash dot org>
|
||||
|
||||
This file is part of gitto.
|
||||
|
||||
|
|
13
zsh/Makefile
Normal file
13
zsh/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
DESTDIR ?= /usr/local
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
$(INSTALL_DATA) _gitto $(DESTDIR)/share/zsh/site-functions/_gitto
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)/share/zsh/site-functions/_gitto
|
||||
|
||||
clean:
|
73
zsh/_gitto
Normal file
73
zsh/_gitto
Normal file
|
@ -0,0 +1,73 @@
|
|||
#compdef gitto
|
||||
|
||||
# gitto -- ZSH completion for gitto
|
||||
# Copyright (C) 2013 Benjamin Althues <benjamin at babab dot nl>
|
||||
|
||||
# This file is part of gitto.
|
||||
|
||||
# gitto is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# gitto is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with gitto. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
local expl
|
||||
local -a repository_locations
|
||||
local -a _gitto_commands _gitto_config_commands _gitto_list_commands
|
||||
|
||||
get_repository_locations() {
|
||||
repository_locations=(${(f)"$(_call_program repository_locations \
|
||||
gitto list locations 2>/dev/null)"})
|
||||
_wanted repository_locations expl 'repository locations' \
|
||||
compadd -a repository_locations
|
||||
}
|
||||
|
||||
_gitto_commands=(
|
||||
"add:register a new repository directory"
|
||||
"check:check if a repository has been registered"
|
||||
"config:show each repository's configuration"
|
||||
"help:display help"
|
||||
"list:list all repositories and their status"
|
||||
"purge:remove all repositories that don't exist"
|
||||
"remove:remove a repository directory"
|
||||
"version:display version"
|
||||
)
|
||||
_gitto_config_commands=(
|
||||
"global:show template configuration"
|
||||
'hooks:install configured hooks for repositories'
|
||||
"update:merge template configuration with each repository's configuration"
|
||||
)
|
||||
_gitto_list_commands=(
|
||||
"locations:list all registered repositories' locations"
|
||||
)
|
||||
|
||||
_arguments '*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "gitto command" _gitto_commands
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
add|check)
|
||||
_files -/ && return 0 ;;
|
||||
config)
|
||||
_describe -t commands "gitto config command" _gitto_config_commands
|
||||
return 0 ;;
|
||||
help|purge|version)
|
||||
return 0 ;;
|
||||
list)
|
||||
_describe -t commands "gitto list command" _gitto_list_commands
|
||||
return 0 ;;
|
||||
remove)
|
||||
get_repository_locations && return 0
|
||||
esac
|
||||
|
||||
# vim: set ft=zsh et ts=2 sw=2 sts=2:
|
Loading…
Reference in a new issue