[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vc-got 3efc759 141/145: cleanup
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vc-got 3efc759 141/145: cleanup |
Date: |
Thu, 9 Sep 2021 15:58:50 -0400 (EDT) |
branch: externals/vc-got
commit 3efc7598f462d03580d55c6a5bfb15201f0e8e49
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>
cleanup
Diff from Philip Kaludercic (philipk [AT] posteo net) with minor
tweaks by me, thanks a lot!
---
vc-got.el | 84 ++++++++++++++++++++++-----------------------------------------
1 file changed, 29 insertions(+), 55 deletions(-)
diff --git a/vc-got.el b/vc-got.el
index 4106adb..5943a06 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -8,7 +8,7 @@
;; URL: https://git.omarpolo.com/vc-got/
;; Keywords: vc tools
;; Version: 0
-;; Package-Requires: ((emacs "27.1"))
+;; Package-Requires: ((emacs "25.1"))
;; 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
@@ -192,7 +192,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no
switches."
(defmacro vc-got-with-worktree (file &rest body)
"Evaluate BODY in the work tree directory of FILE."
- (declare (indent defun))
+ (declare (debug t) (indent defun))
`(when-let (default-directory (vc-got-root ,file))
,@body))
@@ -208,7 +208,7 @@ Assume `default-directory' is inside a got worktree."
"Call `vc-got-program' with ARGS.
The output will be placed in the current buffer."
(apply #'process-file vc-got-program nil (current-buffer) nil
- (cl-remove-if #'null (flatten-list args))))
+ (apply #'nconc (mapcar (lambda (s) (if (listp s) s (list s))) args))))
(defun vc-got--add (files)
"Add FILES to got, passing `vc-register-switches' to the command invocation."
@@ -227,16 +227,16 @@ REVERSE: display the log messages in reverse order.
Return nil if the command failed or if PATH isn't included in any
worktree."
- (let (process-file-side-effects)
+ (let ((process-file-side-effects nil))
(vc-got-with-worktree (or path default-directory)
(when (zerop
(save-excursion
(vc-got--call "log"
- (when limit (list "-l" (format "%s" limit)))
- (when start-commit (list "-c" start-commit))
- (when stop-commit (list "-x" stop-commit))
- (when search-pattern (list "-s" search-pattern))
- (when reverse '("-R"))
+ (and limit (list "-l" (format "%s" limit)))
+ (and start-commit (list "-c" start-commit))
+ (and stop-commit (list "-x" stop-commit))
+ (and search-pattern (list "-s" search-pattern))
+ (and reverse '("-R"))
"--"
path)))
(save-excursion
@@ -260,7 +260,7 @@ files)."
(root (vc-got-root default-directory))
(process-file-side-effects))
(when (zerop (vc-got--call "status"
- (when status-codes (list "-s" status-codes))
+ (and status-codes (list "-s" status-codes))
"--"
(or files dir-or-file)))
(goto-char (point-min))
@@ -306,26 +306,17 @@ ROOT is the root of the repo."
(defun vc-got--tree-parse ()
"Parse into an alist the output of got tree -i in the current buffer."
(goto-char (point-min))
- (cl-loop
- until (= (point) (point-max))
- collect (let* ((obj-start (point))
- (_ (forward-word))
- (obj (buffer-substring obj-start (point)))
- (_ (forward-char)) ; skip the space
- (filename-start (point))
- (_ (move-end-of-line nil))
- (filename (buffer-substring filename-start (point))))
- ;; goto the start of the next line
- (forward-line)
- (move-beginning-of-line nil)
- `(,filename . ,obj))))
+ (let (alist)
+ (while (re-search-forward "^\\([[:word:]]+\\) \\(?:.+\\)+$" nil t)
+ (push (cons (match-string 2) (match-string 1)) alist))
+ alist))
(defun vc-got--tree (commit path)
"Return an alist representing the got tree command output.
The outputted tree will be localised in the given PATH at the
given COMMIT."
(vc-got-with-worktree path
- (let (process-file-side-effects)
+ (let ((process-file-side-effects nil))
(with-temp-buffer
(when (zerop (vc-got--call "tree" "-c" commit "-i" "--" path))
(vc-got--tree-parse))))))
@@ -346,26 +337,11 @@ given COMMIT."
(let (process-file-side-effects)
(with-temp-buffer
(when (zerop (vc-got--call "branch" "-l"))
- (goto-char (point-min))
- (cl-loop
- until (= (point) (point-max))
- ;; parse the `* $branchname: $commit', from the end
- ;; XXX: use a regex?
- collect (let* ((_ (move-end-of-line nil))
- (end-commit (point))
- (_ (backward-word))
- (start-commit (point))
- (_ (backward-char 2))
- (end-branchname (point))
- (_ (move-beginning-of-line nil))
- (_ (forward-char 2))
- (start-branchname (point))
- (branchname (buffer-substring start-branchname
- end-branchname))
- (commit (buffer-substring start-commit end-commit)))
- (forward-line)
- (move-beginning-of-line nil)
- `(,branchname . ,commit)))))))
+ (let (alist)
+ (goto-char (point-min))
+ (while (re-search-forward "^\\* \\(.+\\): \\([[:word:]]+\\)$" nil t)
+ (push (cons (match-string 1) (match-string 2)) alist))
+ alist)))))
(defun vc-got--current-branch ()
"Return the current branch."
@@ -412,14 +388,14 @@ files on disk."
(vc-got-with-worktree (or file default-directory)
(with-temp-buffer
(zerop (vc-got--call "remove"
- (when force "-f")
- (when keep-local "-k")
+ (and force "-f")
+ (and keep-local "-k")
"--"
file)))))
(defun vc-got--ref ()
"Return a list of all references."
- (let (process-file-side-effects
+ (let ((process-file-side-effects nil)
(re "^refs/\\(heads\\|remotes\\|tags\\)/\\(.*\\):")
;; hardcoding HEAD because it's always present and the regexp
;; won't match it.
@@ -818,7 +794,7 @@ revisions''; instead, like with git, you have tags and
branches."
;; FIXME: vc-ensure-vc-buffer won't recognise this buffer as managed
;; by got unless vc-parent-buffer points to a buffer managed by got.
;; investigate why this is needed.
- (set (make-local-variable 'vc-parent-buffer) (find-file-noselect file))
+ (setq-local vc-parent-buffer (find-file-noselect file))
(vc-got--call "blame"
(when rev (list "-c" rev))
"--"
@@ -953,13 +929,11 @@ true, NAME should create a new branch otherwise it will
pop-up a
"Return the list of files with conflicts in directory DIR."
(let* ((root (vc-got-root dir))
(default-directory root)
- (process-file-side-effects))
- (cl-loop with conflicts = nil
- for (file status _) in (vc-got--status "C" ".")
- do (when (and (eq status 'conflict)
- (file-in-directory-p file dir))
- (push file conflicts))
- finally return conflicts)))
+ (process-file-side-effects nil))
+ (cl-loop for (file status _) in (vc-got--status "C" ".")
+ when (and (eq status 'conflict)
+ (file-in-directory-p file dir))
+ collect file)))
(defun vc-got-repository-url (_file &optional remote-name)
"Return URL for REMOTE-NAME, or for \"origin\" if nil."
- [elpa] externals/vc-got 26362bf 110/145: improve error message reporting for vc-got-checkin, (continued)
- [elpa] externals/vc-got 26362bf 110/145: improve error message reporting for vc-got-checkin, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 5212464 115/145: there is no need to require cl-seq, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 83559c7 108/145: add a TODO for the files handling in vc-got-diff, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 186da17 126/145: add a short description under commentary, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 1b2afa9 121/145: rework the vc-dir handling and remove the ugly hack, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 2552a6c 104/145: mark find-ignore-file as done and move it to the right place, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 26b39de 135/145: remove debug macroexpand, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 84beb0d 129/145: add docstring for vc-got-update-on-retrieve-tag, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a1839dc 131/145: don't include the common commit in log-outgoing, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 74b0000 138/145: install a custom process filter for `got send', ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 3efc759 141/145: cleanup,
ELPA Syncer <=
- [elpa] externals/vc-got f457868 024/145: typo, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 06d4d37 031/145: add Makefile, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got ddc59a0 057/145: remove extra parens from vc-got-unregister and fix pcase matchall, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got f8a9db5 060/145: fix vc-got-repository-url for checkout of non-bare repos, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 9e01941 078/145: improve vc-dir presentation & document vc-got-stage in README, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a7777ea 079/145: list also staged addition/removals, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 668dc8e 068/145: vc-got--status: handle stage info and filter result, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 7a5ead6 061/145: vc-got-repository-url: avoid infinite loops in parsing, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 0d57aba 072/145: remove the separator when showing a chunk to stage, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got d346ca6 084/145: ignore ignored files, ELPA Syncer, 2021/09/09