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

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

[elpa] externals/vc-got 6fd5fa324a 1/2: fix vc-got--log with current got


From: ELPA Syncer
Subject: [elpa] externals/vc-got 6fd5fa324a 1/2: fix vc-got--log with current got
Date: Fri, 10 Jun 2022 05:58:25 -0400 (EDT)

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

    fix vc-got--log with current got
    
    'got log' changed the flag for doing searches from -s to -S (-s is now a
    short format log).  Adapt vc-got--log to handle it using the newly
    introduced vc-got--version<=.  While here rename vc-got--program-version
    to vc-got--version.
---
 vc-got.el | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/vc-got.el b/vc-got.el
index 1c7735f345..436d1a0bf1 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -178,13 +178,22 @@ If nil, use the value of `vc-diff-switches'.  If t, use 
no switches."
   (when (version<= version emacs-version)
     `(progn ,@body)))
 
-(defun vc-got--program-version ()
+(defun vc-got--version ()
   "Return string representing the got version."
   (let (process-file-side-effects)
     (with-temp-buffer
       (vc-got--call "-V")
       (substring (buffer-string) 4 -1))))
 
+(defun vc-got--version<= (target)
+  "Compare the current version against TARGET.
+Takes care of handling the -current suffix."
+  (let* ((version-string (vc-got--version))
+         (current-version (string-replace "-current" "" version-string)))
+    (when (version<= current-version target)
+      ;; let X.Y-current sort *after* X.Y
+      (string= version-string current-version))))
+
 (defun vc-got-root (file)
   "Return the work tree root for FILE, or nil."
   (vc-find-root file ".got"))
@@ -227,7 +236,13 @@ INCLUDE-DIFF: display the patch of modifications made in 
each commit.
 
 Return nil if the command failed or if PATH isn't included in any
 worktree."
-  (let ((process-file-side-effects nil))
+  (let* ((process-file-side-effects nil)
+         ;; got 0.71-current at some point switched to -S for search
+         ;; pattern and -s for the one-line format.
+         ;; XXX: remove in a few releases.
+         (search-flag (if (vc-got--version<= "0.71")
+                          "-s"
+                        "-S")))
     (vc-got-with-worktree (or path default-directory)
       (when (zerop
              (save-excursion
@@ -235,7 +250,8 @@ worktree."
                              (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 search-pattern (list search-flag
+                                                       search-pattern))
                              (and reverse '("-R"))
                              (and include-diff '("-p"))
                              ;; "--"



reply via email to

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