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

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

[nongnu] elpa/vc-fossil 6eb44a2 064/111: Refactor next-revision and prev


From: ELPA Syncer
Subject: [nongnu] elpa/vc-fossil 6eb44a2 064/111: Refactor next-revision and previous-revision commands.
Date: Wed, 29 Sep 2021 08:59:22 -0400 (EDT)

branch: elpa/vc-fossil
commit 6eb44a204bcff59deea541c368a3e40929f8c9fc
Author: fifr <fifr>
Commit: fifr <fifr>

    Refactor next-revision and previous-revision commands.
---
 vc/el/vc-fossil.el | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/vc/el/vc-fossil.el b/vc/el/vc-fossil.el
index 86c1344..f5add58 100644
--- a/vc/el/vc-fossil.el
+++ b/vc/el/vc-fossil.el
@@ -338,18 +338,12 @@ If REV is specified, annotate that revision."
   "Fossil specific version of the `vc-previous-revision'."
   (if file
       (with-temp-buffer
-        (let ((found (not rev))
-              (newver nil))
-          (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
-          ;; (vc-fossil--call "fossil" "finfo" "-l" "-b" file)
-          (goto-char (point-min))
-          (while (not (eobp))
-            (let* ((line (buffer-substring-no-properties (point) 
(line-end-position)))
-                   (version (car (split-string line))))
-              (setq newver (or newver (and found version)))
-              (setq found  (string= version rev)))
-            (forward-line))
-          newver))
+        (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
+        (goto-char (point-min))
+        (and (re-search-forward (concat "^" (regexp-quote rev)))
+             (zerop (forward-line))
+             (looking-at "^\\([0-9a-zA-Z]+\\)")
+             (match-string 1)))
     (let ((info (vc-fossil--run "info" rev)))
       (and (string-match "parent: *\\([0-9a-fA-F]+\\)" info)
            (match-string 1 info)))))
@@ -358,18 +352,12 @@ If REV is specified, annotate that revision."
   "Fossil specific version of the `vc-previous-revision'."
   (if file
       (with-temp-buffer
-        (let ((found (not rev))
-              (oldver nil))
-          (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
-          ;; (vc-fossil--call "fossil" "finfo" "-l" "-b" file)
-          (goto-char (point-min))
-          (while (not (eobp))
-            (let* ((line (buffer-substring-no-properties (point) 
(line-end-position)))
-                   (version (car (split-string line))))
-              (setq found  (string= version rev))
-              (setq oldver (or oldver found version)))
-            (forward-line))
-          oldver))
+        (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
+        (goto-char (point-min))
+        (and (re-search-forward (concat "^" (regexp-quote rev)))
+             (zerop (forward-line -1))
+             (looking-at "^\\([0-9a-zA-Z]+\\)")
+             (match-string 1)))
     (let ((info (vc-fossil--run "info" rev)))
       (and (string-match "child: *\\([0-9a-fA-F]+\\)" info)
            (match-string 1 info)))))



reply via email to

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