Commit graph

73 commits

Author SHA1 Message Date
b1a2359036 Only show branches with changes by default
Unless `show-unchanged-branches?' has been set to `#t' in the user's
configuration only branches with pushable or pullable commits are shown.
2013-06-07 22:34:27 +02:00
a936e985a4 Catch wrong number of arguments case
If a command gets the wrong number of arguments, tell the user.
2013-06-05 01:07:56 +02:00
5f3dfee5ac Use a macro to define commands 2013-06-05 00:58:16 +02:00
c00a0ca730 Add some docstrings 2013-05-31 23:41:16 +02:00
62627e6cf6 Properly handle multiple values for settings
Fixes an error that would cause values to be duplicated when specifying
multiple values for a setting.

Prior to this commit specifying multiple values for a setting would
blindly replace one occurrence and add the rest, leaving any possible
other occurrences intact. When starting fresh this would not be a
problem, but using it multiple times would add the same settings
repeatedly.

- gitto/config.scm (merge-setting): If the given value is a of type
  `list', replace the `%a' specifier for each item in it.

- gitto/config.scm (merge-settings): Move the handling of the case of
  `v' being a list into `merge-setting'.

- gitto/config.scm (split-setting): Rename `parse-setting' to
  `split-setting'. Return a cons cell instead of a list.

- gitto/config.scm (read-setting): New function.

- gitto/config.scm (read-config): Remove unused variable. Use
  `read-setting' to get the right value for each line of the config
  file.

- gitto/config.scm (write-setting): In case we're dealing with a list,
  print each value separately.
2013-05-29 23:10:26 +02:00
1027b3c7d6 Add user manual to site 2013-05-27 22:51:54 +02:00
e027f3c7e6 Add clean make target 2013-05-27 22:40:37 +02:00
7f6037855d Add user manual 2013-05-27 22:30:00 +02:00
aa0accc977 Add Makefile for zsh/
Installs the ZSH completion module into
`DESTDIR/shar/zsh/site-functions/_gitto'.
2013-05-26 19:09:07 +02:00
Benjamin Althues
5c0189e9ca Add zsh command completion function
Add completion for gitto (sub)commands and arguments for users
of the Z shell.
2013-05-26 18:20:39 +02:00
dd41bb1272 Update README and other files, add site/ 2013-05-26 14:39:45 +02:00
6c05056f84 Allow multiple values for config settings
Setting a list as a value for `global-config' will instruct gitto to
place that setting in the config more than once. For example:

,----
| (set! global-config
|       '(("remote \"origin\""
|          ("url" . "git@somehost.com:~a.git")
|          ("pushurl" "git@somehost.com:~a.git"
|                     "git@someotherhost.com:user/~a.git"))))
`----

Will produce output similar to:

,----
| [remote "origin"]
|         url = git@somehost.com:repo-name.git
|         pushurl = git@somehost.com:repo-name.git
|         pushurl = git@someotherhost.com:user/repo-name.git
`----

The ordering may vary depending on what was already found in the
`origin' remote's settings.

gitto doesn't know or care which settings can and cannot appear more
than once in a configuration, it is up to the user to provide valid
values.
2013-05-25 20:49:55 +02:00
439a262ec4 Add simple hook management
Introduces a new user configuration variable `hook-alist', which
specifies which hooks to link to which executables, for example:

,----
| (set! hook-alist '(("commit-msg" . "/path/to/my/commit/msg/hook")))
`----

With this setting the command `config hooks' will install
`/path/to/my/commit/msg/hook' to the `commit-msg' hook of each
repository not in the `config-exclusion-list' setting.
2013-05-25 20:29:33 +02:00
8b3f0d16d3 Ask to merge settings when registering repo
The `add' command will ask the user if they would like to merge their
settings with the newly registered repository's if the current input
is a tty and if the user has specified some settings.

The default for this is `#t', so pressing <RET> when presented with
this question will merge the settings, however if the user is never
asked (because the input is not a tty) no merge will happen.
2013-05-23 23:11:10 +02:00
cd8a7c310c Add DESTDIR as prefix to extension destination
The `pkg-config' program needs to know about the prefix DESTDIR to
determine where the files in `src/' should be installed. If this
option is not passed along to `pkg-config' it will always try to
install in `/usr/'.
2013-05-23 22:05:50 +02:00
1be9047b00 Update help message 2013-05-21 03:00:56 +02:00
7cf38f5121 Change name 2013-05-20 23:42:31 +02:00
70eca89c39 Add simplistic command structure
Now instead of using `gitto --register' or `gitto -r' one would use
`gitto add'. Here is the list of what was and what is:

--version, -v      => version
--help, -h         => help
--register, -r     => add
--remove, -R       => remove
--repositories, -l => list locations
--purge, -p        => purge
--check, -c        => check
--config, -C       => config
--global-config    => config global
--update-config    => config update

Running gitto without arguments keeps the same functionality, though
it can also be called as `gitto list'.
2013-05-20 22:27:20 +02:00
e293a71f9c Remove docstring from config-exclusion-list
Apparently that is not the right place for a docstring, I must have
been thinking about emacs lisp.
2013-05-20 20:39:56 +02:00
e2c303c420 Add exclusion list
The variable `config-exclusion-list' can be used to specify project
names that should not have their configuration overwritten by
`gitto --update-config'. It is a normal list of strings which name the
repositories that should be left alone, like so:

    (set! config-exclusion-list '("repo1" "repo2" "repo3"))
2013-05-19 23:05:31 +02:00
d2db2dfb53 Add config management commands
These commands parse the git configuration file and, merge settings
defined in the rc.scm and print out the resulting configuration.
2013-05-17 01:02:39 +02:00
964756b730 Split git function into separate module 2013-05-12 20:37:54 +02:00
a3d1cc969f Fix some bugs
- The `register-repository' procedure was using a non-existent
  procedure `repository-name', this should be `repo-name'.

- The `purge' procedure was working on a collection of `<repository>'
  objects, but assuming they were file names, the `repo-location'
  should first be extracted before calling `file-exists?'.
2013-05-12 15:03:00 +02:00
addf53abed Fix error when XDG_*_HOME is specified
Unlike some other lisps scheme's `unless' returns `#<unspecified>'
instead of nil, and `string-append' doesn't accept this as a valid
argument. So use an empty string if XDG_*_HOME has been specified and
FALLBACK otherwise.
2013-05-10 21:58:31 +02:00
87217e9858 Show status per branch
Instead of looking at the current HEAD, look at each branch
separately. This also means that if you customize the `print' method
in your init file you should also go over all the branches. You can
now also customize the `print' method for the `<branch>' type.
2013-05-05 19:27:36 +02:00
387e3f1c67 Turn format function into a generic method
This changes the way formatting functions can be customized in the init
file to:

,----
| (define-method (print (repo <repository>))
|   (format #t "~a: ~d up; ~d down; ~a. Updated ~a~%"
|           (repo-name repo) (repo-pushable repo) (repo-pullable repo)
|           (if (repo-clean? repo) "clean" "dirty") (repo-updated repo)))
`----

Note that it is possible that REPO doesn't exist, so you should always
check for that first.
2013-05-05 18:18:18 +02:00
3ddbd6c743 Use lazy evaluation to speed-up startup
Before using goops the relevant information was gathered when it was
needed, but now with goops everything is gathered at startup. So use
lazy evaluation to defer that gathering until it is needed.
2013-05-05 16:31:16 +02:00
fb61517ac1 Use goops to encapsulate repositories 2013-05-05 14:50:46 +02:00
fc17fbd0e0 Separate repository line formatting into format-repository
This way people can override this function in their RC files, and
specify what information they would like to see where.

They would do this with, for example:

,----
| (set! format-repository
|       (lambda (name pushable pullable clean? updated)
|         (format #t "~a: ~d up; ~d down; ~a. Updated ~a\n"
|                 name pushable pullable (if clean? "clean" "dirty")
|                 updated)))
`----

To turn each line into the like of:

,----
| gitto: 1 up; 0 down; dirty. Updated 4 months ago
`----
2013-05-05 03:04:47 +02:00
77513487aa Load an initialization file at startup
This file is located either in XDG_CONFIG_HOME or, in case
XDG_CONFIG_HOME is empty, in HOME/.config/gitto.
2013-05-05 02:51:36 +02:00
c688bfb73e Try : instead of #+BEGIN_EXAMPLE
It might be parsed better by some parsers, let's see.
2013-01-20 13:24:48 +01:00
09ace1bc4b Replace README.markdown with README.org
And add .0 to version
2013-01-20 13:20:52 +01:00
6246b977c3 Add -p option to help and fix typo
The `-p' option was already implemented, but it wasn't yet explained
in the help output.
2013-01-20 13:03:58 +01:00
f64b974f27 Bump version 2012-10-17 23:56:46 +02:00
86c81c89ab Checkdoc-suggested changes 2012-10-17 23:48:20 +02:00
944001ce94 Add unregister command to emacs interface
* emacs/gitto.el (gitto-registered-p): New function.
  (gitto-unregister): New command
  (gitto-register): Add docstring.
2012-10-17 23:46:31 +02:00
8e71888602 Doc update 2012-10-17 01:45:16 +02:00
3c81ade7bf Tiny style cleanup 2012-10-17 01:41:21 +02:00
aedb4491bd Add check command
Checks to see if the specified directory has been registered.
2012-10-17 01:40:01 +02:00
8866cc66c3 Add emacs interface
Only has a `gitto-register' function for now.  Just a start.
2012-10-16 22:47:48 +02:00
b585ff11d0 Use ? for bool values 2012-09-26 00:22:32 +02:00
0b9682ea2b Add --purge
`--purge' deletes all the repositories from gitto that don't exist on
the filesystem (anymore).
2012-09-26 00:21:06 +02:00
0bcd0b9c5a If PATH_MAX is defined, use it 2012-09-18 19:58:32 +02:00
395436103f Check if we know the argument to -R
If we don't, fail in getopt-long.
2012-09-18 19:46:14 +02:00
b66ceb70f7 Don't fail with no-longer existing repos
When a repo is in the repositories list, but not where it should be,
don't care, if we know it, delete it.

Don't require the argument for delete to exist on the filesystem.
2012-09-18 19:38:30 +02:00
963c85b479 Return #f when no path is found
Return `SCM_BOOL_F' when `realpath' can't find the path.
2012-09-18 19:35:54 +02:00
d47e68fe21 Don't fail when a repository can't be found
Report it instead.
2012-09-18 08:47:35 +02:00
2f0fd8d03e Use guile-snarf
Because it looks cooler.

This way its easy to keep all the information about the function in
one place, and it makes it easier/more interesting to add new
functions later.
2012-08-01 21:12:09 +02:00
f7016aea18 Add GPL comments 2012-07-31 02:48:00 +02:00
7ca2408b51 Add relative directory parsing
As of now, when using `-r' or `-R', relative directories can be used.
This *does not* include locations starting with `~', those still need
to be handled by your shell.

Because every repo is treated as a possible relative path, and thus
passed on to `realpath', the paths have become very uniform.  This
means that it will now only register and unregister paths that don't
have a trailing `/'.  This is not true during usage, so those paths
still work, but they can't be removed by gitto, and adding them again
will create a duplicate entry.

* gitto/Makefile (objects): Add `path.scm' and `path.go'.

  (.PHONY): Add `all' as a phony target.

  (all): New target, compiles all `.go' targets.

  ($(filter %.go,$(objects))): Use `env' to run guild so that include
  paths are setup properly.

* gitto/main.scm (gitto): Use new `(gitto path)' module, it contains
  the `realpath' function.

  (register-repository):
  (remove-repository): Always pass REPOSITORY through `realpath' and
  use the result.

* gitto/path.scm: New file. Loads the `libguile-gitto-path' extension
  and exports its `realpath' function.

* src/Makefile (CFLAGS):
  (LDFLAGS): Use `pkg-config' to gather the necessary values for guile.

  (libguile-gitto-path.so): New guile extension, wraps the `readline'
  POSIX function.

* src/gitto-path.c: New file, wraps and exports the `realpath' POSIX
  function from `stdlib.h'.
2012-07-31 02:40:56 +02:00