branch: elpa/vc-fossil commit ac820447b1411d72d5f659083818128b3f4d3fe9 Author: fifr <fifr> Commit: fifr <fifr>
Do not raise errors in next-revision and previous-revision commands. The functions should just return nil if no parent or child could be found. --- vc/el/vc-fossil.el | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/vc/el/vc-fossil.el b/vc/el/vc-fossil.el index f5add58..4c2169e 100644 --- a/vc/el/vc-fossil.el +++ b/vc/el/vc-fossil.el @@ -336,31 +336,37 @@ If REV is specified, annotate that revision." (defun vc-fossil-previous-revision (file rev) "Fossil specific version of the `vc-previous-revision'." - (if file - (with-temp-buffer - (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))))) + (with-temp-buffer + (cond + (file + (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b") + (goto-char (point-min)) + (and (re-search-forward (concat "^" (regexp-quote rev)) nil t) + (zerop (forward-line)) + (looking-at "^\\([0-9a-zA-Z]+\\)") + (match-string 1))) + (t + (vc-fossil-command t 0 nil "info" rev) + (goto-char (point-min)) + (and (re-search-forward "parent: *\\([0-9a-fA-F]+\\)" nil t) + (match-string 1)))))) (defun vc-fossil-next-revision (file rev) "Fossil specific version of the `vc-previous-revision'." - (if file - (with-temp-buffer - (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))))) + (with-temp-buffer + (cond + (file + (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b") + (goto-char (point-min)) + (and (re-search-forward (concat "^" (regexp-quote rev)) nil t) + (zerop (forward-line -1)) + (looking-at "^\\([0-9a-zA-Z]+\\)") + (match-string 1))) + (t + (vc-fossil-command t 0 nil "info" rev) + (goto-char (point-min)) + (and (re-search-forward "child: *\\([0-9a-fA-F]+\\)" nil t) + (match-string 1)))))) (defun vc-fossil-delete-file (file) (vc-fossil-command nil 0 (file-truename file) "rm" "--hard"))