Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 01, 2012
@ryuslash Add switch to list saved repository locations 4820492
@ryuslash Minor style change 4bcea92
@ryuslash 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.
Showing with 36 additions and 20 deletions.
  1. +36 −20 gitto/main.scm
56 gitto/main.scm
@@ -33,6 +33,7 @@
gitto [options]
-r, --register REPO Register a new repository directory
-R, --remove REPO Repmove a repository directory
+ -l, --repositories List all registered repositories' locations
-v, --version Display version
-h, --help Display this help
@@ -90,33 +91,48 @@ gitto [options]
(close-pipe pipe)
+(define (git-last-update)
+ (let* ((pipe (open-input-pipe "git log -1 --format=%ar @{u}"))
+ (relative-last-update (read-line pipe)))
+ (close-pipe pipe)
+ relative-last-update))
(define (list-repositories)
+ (for-each
+ (lambda (repo)
+ (chdir repo)
+ (let ((numup (git-revs-to-push))
+ (numdown (git-revs-to-pull))
+ (clean? (git-clean?))
+ (lastupdate (git-last-update)))
+ (format #t
+ "~a:~15t~d to push, ~d to pull and is ~adirty. Last update: ~a\n"
+ (basename repo) numup numdown (if clean? "not " "") lastupdate)))
+ repositories))
+(define (list-repository-locations)
(for-each (lambda (repo)
- (chdir repo)
- (let ((numup (git-revs-to-push))
- (numdown (git-revs-to-pull))
- (clean? (git-clean?)))
- (format #t "~a:~15t~d to push, ~d to pull and is ~adirty.\n"
- (basename repo) numup numdown
- (if clean? "not " ""))))
+ (display repo)
+ (newline))
(define option-spec
- `((version (single-char #\v) (value #f))
- (help (single-char #\h) (value #f))
- (register (single-char #\r) (value #t)
- (predicate ,git-dir?))
- (remove (single-char #\R) (value #t)
- (predicate ,git-dir?))))
+ `((version (single-char #\v))
+ (help (single-char #\h))
+ (register (single-char #\r) (value #t) (predicate ,git-dir?))
+ (remove (single-char #\R) (value #t) (predicate ,git-dir?))
+ (repositories (single-char #\l))))
(define (main args)
(let* ((options (getopt-long args option-spec))
- (help-wanted (option-ref options 'help #f))
- (version-wanted (option-ref options 'version #f))
+ (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)))
- (cond (version-wanted (version))
- (help-wanted (help))
+ (removal (option-ref options 'remove #f))
+ (list (option-ref options 'repositories #f)))
+ (cond (version-wanted (version))
+ (help-wanted (help))
(registration-needed => register-repository)
- (removal => remove-repository)
- (#t (list-repositories)))))
+ (removal => remove-repository)
+ (list (list-repository-locations))
+ (#t (list-repositories)))))

No commit comments for this range

Something went wrong with that request. Please try again.