emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vc-got 518ede1 010/145: augment vc-got--log


From: ELPA Syncer
Subject: [elpa] externals/vc-got 518ede1 010/145: augment vc-got--log
Date: Thu, 9 Sep 2021 15:58:23 -0400 (EDT)

branch: externals/vc-got
commit 518ede14d1f7da94e0e6e1216bdce4dd33be55ca
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    augment vc-got--log
---
 vc-got.el | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/vc-got.el b/vc-got.el
index 0208d51..0c2a5a1 100644
--- a/vc-got.el
+++ b/vc-got.el
@@ -71,6 +71,7 @@
   (require 'subr-x))
 
 (require 'cl-lib)
+(require 'cl-seq)
 (require 'seq)
 (require 'vc)
 
@@ -99,17 +100,27 @@
   (with-temp-buffer
     (apply #'vc-got--call "add" (append vc-register-switches files))))
 
-(defun vc-got--log (limit path)
+(defun vc-got--log (&optional path limit start-commit search-pattern)
   "Execute the log command in the worktree of PATH.
-
-The output of the command will be put in the current-buffer.
+The output in the current buffer.
 
 LIMIT limits the maximum number of commit returned.
 
+START-COMMIT: start traversing history at the specified commit.
+SEARCH-PATTERN: limit to log messages matched by the regexp given.
+
 Return nil if the command failed or if PATH isn't included in any
 worktree."
-  (vc-got-with-worktree path
-    (zerop (vc-got--call "log" "-l" (format "%s" limit) path))))
+  (vc-got-with-worktree (or path default-directory)
+    (zerop
+     (apply #'vc-got--call
+            (cl-remove-if #'null
+                          (flatten-list
+                           (list "log"
+                                 (when limit (list "-l" (format "%s" limit)))
+                                 (when start-commit (list "-c" start-commit))
+                                 (when search-pattern (list "-s" 
search-pattern))
+                                 path)))))))
 
 (defun vc-got--status (dir-or-file &rest files)
   "Return the output of ``got status''.
@@ -251,7 +262,7 @@ DIR-OR-FILE."
   "Return the id of the last commit that touched the FILE or \"0\" for a new 
(but added) file."
   (or
    (with-temp-buffer
-     (when (vc-got--log 1 file)
+     (when (vc-got--log file 1)
        (let (start)
          (goto-char (point-min))
          (forward-line 1)               ;skip the ----- line



reply via email to

[Prev in Thread] Current Thread [Next in Thread]