Respect 80 chars per line in core-release-management.el

This commit is contained in:
syl20bnr 2016-08-03 20:35:40 -04:00
parent 265faecbba
commit d3ae04b29c
1 changed files with 25 additions and 22 deletions

View File

@ -50,16 +50,21 @@ users on `develop' branch must manually pull last commits instead."
(format "Version (default %s [latest]): " last-version) (format "Version (default %s [latest]): " last-version)
nil nil last-version)))) nil nil last-version))))
(cond ((string-equal "develop" branch) (cond ((string-equal "develop" branch)
(message (concat "Cannot switch version because you are on develop.\n" (message (concat "Cannot switch version because you are on "
"You have to manually `pull --rebase' the latest commits."))) "develop.\n"
"You have to manually `pull --rebase' the latest "
"commits.")))
(dirty (dirty
(message "Your Emacs directory is not clean.\ngit status:\n%s" dirty)) (message (concat "Your Emacs directory is not clean.\n"
"git status:\n%s") dirty))
((string-equal version spacemacs-version) ((string-equal version spacemacs-version)
(message "You are already on the latest version.")) (message "You are already on the latest version."))
((or (string-equal "master" branch) ((or (string-equal "master" branch)
(yes-or-no-p (yes-or-no-p
(format (concat "You are not on master. This command will switch branches.\n" (format (concat "You are not on master. "
"Are you sure that you want to switch to version %s ? ") "This command will switch branches.\n"
"Are you sure that you want to switch "
"to version %s ? ")
version))) version)))
(let ((tag (concat "v" version))) (let ((tag (concat "v" version)))
(if (spacemacs/git-hard-reset-to-tag tag) (if (spacemacs/git-hard-reset-to-tag tag)
@ -68,8 +73,7 @@ users on `develop' branch must manually pull last commits instead."
(message "Succesfully switched to version %s" version)) (message "Succesfully switched to version %s" version))
(message "An error occurred while switching to version %s" (message "An error occurred while switching to version %s"
version)))) version))))
(t (t (message "Update aborted.")))))
(message "Update aborted.")))))
(defun spacemacs/check-for-new-version (&optional interval) (defun spacemacs/check-for-new-version (&optional interval)
"Periodicly check for new for new Spacemacs version. "Periodicly check for new for new Spacemacs version.
@ -86,7 +90,8 @@ found."
(async-start (async-start
`(lambda () `(lambda ()
,(async-inject-variables "\\`spacemacs-start-directory\\'") ,(async-inject-variables "\\`spacemacs-start-directory\\'")
(load-file (concat spacemacs-start-directory "core/core-load-paths.el")) (load-file (concat spacemacs-start-directory
"core/core-load-paths.el"))
(require 'core-spacemacs) (require 'core-spacemacs)
(spacemacs/get-last-version)) (spacemacs/get-last-version))
(lambda (result) (lambda (result)
@ -103,9 +108,7 @@ found."
(setq spacemacs-version-check-timer (setq spacemacs-version-check-timer
(run-at-time t (timer-duration interval) (run-at-time t (timer-duration interval)
'spacemacs/check-for-new-version)))) 'spacemacs/check-for-new-version))))
(t (t (message "Skipping check for new version (reason: async not loaded)"))))
(message "Skipping check for new version (reason: async not loaded)"))
))
(defun spacemacs/get-last-version () (defun spacemacs/get-last-version ()
"Return the last tagged version." "Return the last tagged version."
@ -144,7 +147,7 @@ version and the NEW version."
(defun spacemacs/git-has-remote (remote) (defun spacemacs/git-has-remote (remote)
"Return non nil if REMOTE is declared." "Return non nil if REMOTE is declared."
(let((proc-buffer "git-has-remote") (let ((proc-buffer "git-has-remote")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil "remote")) (when (eq 0 (process-file "git" nil proc-buffer nil "remote"))
(with-current-buffer proc-buffer (with-current-buffer proc-buffer
@ -155,7 +158,7 @@ version and the NEW version."
(defun spacemacs/git-add-remote (remote url) (defun spacemacs/git-add-remote (remote url)
"Add a REMOTE with URL, return t if no error." "Add a REMOTE with URL, return t if no error."
(let((proc-buffer "git-add-remote") (let ((proc-buffer "git-add-remote")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog1 (prog1
(eq 0 (process-file "git" nil proc-buffer nil (eq 0 (process-file "git" nil proc-buffer nil
@ -164,7 +167,7 @@ version and the NEW version."
(defun spacemacs/git-remove-remote (remote) (defun spacemacs/git-remove-remote (remote)
"Remove a REMOTE, return t if no error." "Remove a REMOTE, return t if no error."
(let((proc-buffer "git-remove-remote") (let ((proc-buffer "git-remove-remote")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog1 (prog1
(eq 0 (process-file "git" nil proc-buffer nil (eq 0 (process-file "git" nil proc-buffer nil
@ -173,7 +176,7 @@ version and the NEW version."
(defun spacemacs/git-fetch-remote (remote) (defun spacemacs/git-fetch-remote (remote)
"Fetch last commits from REMOTE, return t if no error." "Fetch last commits from REMOTE, return t if no error."
(let((proc-buffer "git-fetch-remote") (let ((proc-buffer "git-fetch-remote")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog1 (prog1
(eq 0 (process-file "git" nil proc-buffer nil (eq 0 (process-file "git" nil proc-buffer nil
@ -182,7 +185,7 @@ version and the NEW version."
(defun spacemacs/git-fetch-tags (remote branch) (defun spacemacs/git-fetch-tags (remote branch)
"Fetch the tags for BRANCH in REMOTE repository." "Fetch the tags for BRANCH in REMOTE repository."
(let((proc-buffer "git-fetch-tags") (let ((proc-buffer "git-fetch-tags")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog2 (prog2
;;;; original comment: seems necessary to fetch first ;;;; original comment: seems necessary to fetch first
@ -196,7 +199,7 @@ version and the NEW version."
(defun spacemacs/git-hard-reset-to-tag (tag) (defun spacemacs/git-hard-reset-to-tag (tag)
"Hard reset the current branch to specifed TAG." "Hard reset the current branch to specifed TAG."
(let((proc-buffer "git-hard-reset") (let ((proc-buffer "git-hard-reset")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog1 (prog1
(eq 0 (process-file "git" nil proc-buffer nil (eq 0 (process-file "git" nil proc-buffer nil
@ -205,7 +208,7 @@ version and the NEW version."
(defun spacemacs/git-latest-tag (remote branch) (defun spacemacs/git-latest-tag (remote branch)
"Returns the latest tag on REMOTE/BRANCH." "Returns the latest tag on REMOTE/BRANCH."
(let((proc-buffer "git-latest-tag") (let ((proc-buffer "git-latest-tag")
(default-directory (file-truename spacemacs-start-directory)) (default-directory (file-truename spacemacs-start-directory))
(where (format "%s/%s" remote branch))) (where (format "%s/%s" remote branch)))
(when (eq 0 (process-file "git" nil proc-buffer nil (when (eq 0 (process-file "git" nil proc-buffer nil
@ -224,7 +227,7 @@ version and the NEW version."
(defun spacemacs/git-checkout (branch) (defun spacemacs/git-checkout (branch)
"Checkout the given BRANCH. Return t if there is no error." "Checkout the given BRANCH. Return t if there is no error."
(let((proc-buffer "git-checkout") (let ((proc-buffer "git-checkout")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(prog1 (prog1
(eq 0 (process-file "git" nil proc-buffer nil (eq 0 (process-file "git" nil proc-buffer nil
@ -233,7 +236,7 @@ version and the NEW version."
(defun spacemacs/git-get-current-branch () (defun spacemacs/git-get-current-branch ()
"Return the current branch. Return nil if an error occurred." "Return the current branch. Return nil if an error occurred."
(let((proc-buffer "git-get-current-branch") (let ((proc-buffer "git-get-current-branch")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil (when (eq 0 (process-file "git" nil proc-buffer nil
"symbolic-ref" "--short" "-q" "HEAD")) "symbolic-ref" "--short" "-q" "HEAD"))
@ -250,7 +253,7 @@ version and the NEW version."
(defun spacemacs/git-get-current-branch-rev () (defun spacemacs/git-get-current-branch-rev ()
"Returns the hash of the head commit on the current branch. "Returns the hash of the head commit on the current branch.
Returns nil if an error occurred." Returns nil if an error occurred."
(let((proc-buffer "git-get-current-branch-head-hash") (let ((proc-buffer "git-get-current-branch-head-hash")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil (when (eq 0 (process-file "git" nil proc-buffer nil
"rev-parse" "--short" "HEAD")) "rev-parse" "--short" "HEAD"))
@ -267,7 +270,7 @@ Returns nil if an error occurred."
(defun spacemacs/git-working-directory-dirty () (defun spacemacs/git-working-directory-dirty ()
"Non-nil if the user's emacs directory is not clean. "Non-nil if the user's emacs directory is not clean.
Returns the output of git status --porcelain." Returns the output of git status --porcelain."
(let((proc-buffer "git-working-directory-dirty") (let ((proc-buffer "git-working-directory-dirty")
(default-directory (file-truename spacemacs-start-directory))) (default-directory (file-truename spacemacs-start-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil (when (eq 0 (process-file "git" nil proc-buffer nil
"status" "--porcelain")) "status" "--porcelain"))