Commit graph

62 commits

Author SHA1 Message Date
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
731fba1dc4 Fix unterminated variable reference 2012-07-31 02:26:34 +02:00
a0fb2ed62c Seperate settings to env
Set environment settings in `env' and have `run-gitto' use it, this
makes it easy for other commands (like make) to utilize this as well.

* env: New file, set environment variables needed to do anything with
  gitto outside of an installed state.

* run-gitto: Move environment settings to `env' and just run it.
2012-07-31 02:21:38 +02:00
124de5657f Update/add docstrings 2012-07-08 23:18:39 +02:00
b836a9b02f Use guild, not guile tools
`guile-tools' only still exists for compatibility with guile-1.8, but
it has been renamed to `guild'.
2012-07-04 22:19:38 +02:00
7c96197cff Compile main.go before installing 2012-07-04 22:11:55 +02:00
cf2ba48313 Add GPL license and necessary comments 2012-07-01 23:23:11 +02:00
c9515188ab Shorten line 2012-07-01 22:42:42 +02:00
984abc17b3 Make installation a bit better
Installation now goes into the official site directories for guile,
both for *.go as *.scm.
2012-07-01 22:41:19 +02:00
884bb23ad3 Handle brand-new repositories better
stderr from the underlying git process was not being
redirected/ignored properly, now somewhat more.  If EOF is encountered
when asking for the last update date it is shown as "never".
2012-07-01 20:47:45 +02:00
6da8b42171 Sort repositories
Upon saving, sort the repositories alphabetically by `basename'.  When
`-l' is provided sort before output by location.
2012-07-01 20:25:03 +02:00
58dcd2fa57 Add Last update to normal output
When viewing the status of your repositories you will now see also
when your last update to the upstream branch was. If you have not
fetched or pulled the latest changes from your upstream, this will not
be accurate.
2012-07-01 20:03:59 +02:00