branch: elpa/vc-fossil
commit 0ab9dceac55e485d0ae62d7517dbde7a201b5718
Author: fifr <fifr>
Commit: fifr <fifr>
Implement diff for the root directory.
Fossil does not allow to specify directories for the diff command. But
this is required for, e.g., `log-view-diff`. Currently only the
special case of the root directory being passed is handled (i.e. diff
the whole tree).
---
vc/el/vc-fossil.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/vc/el/vc-fossil.el b/vc/el/vc-fossil.el
index 24eeeb6..84261a9 100644
--- a/vc/el/vc-fossil.el
+++ b/vc/el/vc-fossil.el
@@ -273,11 +273,18 @@ If `files` is nil return the status for all files."
("^=== \\(.*\\) ==="
(1 'change-log-date))))))
-(defun vc-fossil-diff (file &optional rev1 rev2 buffer)
+;; TODO: implement diff for directories
+(defun vc-fossil-diff (files &optional rev1 rev2 buffer)
"Get Differences for a file"
- (let ((buf (or buffer "*vc-diff*")))
+ (let ((buf (or buffer "*vc-diff*"))
+ (root (and files (expand-file-name (vc-fossil-root (car files))))))
+ ;; if we diff the root directory, do not specify a file
+ (if (or (null files)
+ (and (null (cdr files))
+ (equal root (expand-file-name (car files)))))
+ (setq files nil))
(apply #'vc-fossil-command
- buf 0 file "diff" "-i"
+ buf 0 files "diff" "-i"
(nconc
(cond
(rev2 (list "--from" (or rev1 "current") "--to" rev2))