[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 18/39: Copes better with missing repos. Improved output.
From: |
Phillip Lord |
Subject: |
[elpa] 18/39: Copes better with missing repos. Improved output. |
Date: |
Mon, 20 Oct 2014 08:22:37 +0000 |
phillord pushed a commit to branch externals/pabbrev
in repository elpa.
commit d57e68348c186b0423709705a89f7b9bdac5a029
Author: Phillip Lord <address@hidden>
Date: Mon Sep 23 20:56:13 2013 +0100
Copes better with missing repos.
Improved output.
---
git-update.el | 44 ++++++++++++++++++++++++++------------------
1 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/git-update.el b/git-update.el
index ff94a28..fb8ef51 100644
--- a/git-update.el
+++ b/git-update.el
@@ -10,7 +10,7 @@
;; COPYRIGHT NOTICE
;;
-;; This program is free software; you can redistribute it and/or modify
+;; 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
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
@@ -52,7 +52,7 @@
;;; Code:
(defvar git-update-install-root (concat user-emacs-directory "git-packages"))
-(defvar git-update-frequency 1)
+(defvar git-update-frequency 7)
(defvar git-update-buffer (get-buffer-create "*git-update*"))
(defun git-update (repo &optional location)
@@ -61,17 +61,22 @@
If not then run git clone. If not check whether the file
.git/FETCH_HEAD is older than `git-update-frequency' days old. If
it is run git pull. Otherwise, do nothing
-Optional argument LOCATION is the directory into which the REPO will be
cloned,
+Optional argument LOCATION is the directory into which the REPO will be cloned,
otherwise `git-update-install-root' will be used."
- (let* ((location (or location git-update-install-root))
+ (let* ((location
+ (or location
+ (progn
+ (when (not (file-exists-p git-update-install-root))
+ (make-directory git-update-install-root))
+ git-update-install-root)))
(project-dir
(concat (or location
git-update-install-root) "/"
(git-update-dir-from-git repo))))
(if (file-exists-p project-dir)
- (git-update-maybe project-dir)
+ (git-update-maybe repo project-dir)
(git-update-clone repo location)
- (git-update-maybe project-dir))
+ (git-update-maybe repo project-dir))
(let ((default-directory project-dir))
(normal-top-level-add-subdirs-to-load-path))
(add-to-list 'load-path project-dir)
@@ -94,36 +99,39 @@ otherwise `git-update-install-root' will be used."
repo)
(message (format "Clone: %s...done" repo)))
-(defun git-update-maybe (git-location)
+(defun git-update-maybe (repo git-location)
;; after a clone, FETCH_HEAD doesn't exist. So, we can't tell when the clone
;; happened. So, do a pull anyway.
(let ((fetch-head (concat git-location "/.git/FETCH_HEAD")))
(if (not (file-exists-p fetch-head))
- (git-update-do git-location)
+ (git-update-do repo git-location)
(let ((age
(-
- (nth 1
- (current-time))
- (nth 1
- (nth 5
- (file-attributes
- (concat git-location "/.git/FETCH_HEAD" )))))))
+ (time-to-seconds
+ (current-time))
+ (time-to-seconds
+ (nth 5
+ (file-attributes
+ (concat git-location "/.git/FETCH_HEAD" )))))))
(if (> age (* git-update-frequency 60 60 24))
- (git-update-do git-location)
+ (git-update-do repo git-location)
(with-current-buffer
git-update-buffer
(goto-char (point-max))
(insert (format "Not updating %s\n" git-location))))))))
-(defun git-update-do (git-location)
+(defun git-update-do (repo git-location)
(display-buffer git-update-buffer)
(set-buffer git-update-buffer)
(goto-char (point-max))
- (insert (format "Updating: %s\n" git-location))
+ (insert (format "Updating: %s\n\tfrom %s\n"
+ git-location repo))
(goto-char (point-max))
(cd git-location)
(call-process "git" nil git-update-buffer t "pull")
- (message (format "Updating: %s...done" git-location)))
+ ;; put an extra new line if call-process returns non-zero
+ (insert "\n")
+ (message "Updating: %s...done" git-location))
(provide 'git-update)
;;; git-update.el ends here
- [elpa] 09/39: Added slime mode to excluded modes, (continued)
- [elpa] 09/39: Added slime mode to excluded modes, Phillip Lord, 2014/10/20
- [elpa] 06/39: Prepared for Marmalade, Phillip Lord, 2014/10/20
- [elpa] 11/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 12/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 16/39: Clojure mode support added., Phillip Lord, 2014/10/20
- [elpa] 15/39: Documentation Updates., Phillip Lord, 2014/10/20
- [elpa] 13/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 17/39: Version number added. Documentation fix. Indentation fix., Phillip Lord, 2014/10/20
- [elpa] 05/39: Ported from generic.el to define-derived-mode. Comment-character is now "#" rather than fudged "# " Delimited URIs now recognised as strings Electric indentation added. Indentation engine improved., Phillip Lord, 2014/10/20
- [elpa] 20/39: New keywords added., Phillip Lord, 2014/10/20
- [elpa] 18/39: Copes better with missing repos. Improved output.,
Phillip Lord <=
- [elpa] 19/39: Markdown support added., Phillip Lord, 2014/10/20
- [elpa] 21/39: Exclude nrepl mode., Phillip Lord, 2014/10/20
- [elpa] 14/39: Initial checkin., Phillip Lord, 2014/10/20
- [elpa] 23/39: Some code re-organisation. Checks whether pulse.el can cope with foreground pulse., Phillip Lord, 2014/10/20
- [elpa] 25/39: pabbrev-mode now sets inhibit-modification-hooks, Phillip Lord, 2014/10/20
- [elpa] 26/39: Improved keyboard handling., Phillip Lord, 2014/10/20
- [elpa] 22/39: Initial checkin, Phillip Lord, 2014/10/20
- [elpa] 27/39: Add cider-nrepl mode to ignored., Phillip Lord, 2014/10/20
- [elpa] 24/39: Keywords, Status added., Phillip Lord, 2014/10/20
- [elpa] 32/39: README.md added., Phillip Lord, 2014/10/20