branch: externals/vc-got
commit 7bb16f79d9239b75da67f85f08d4a6586d7ecb14
Author: Omar Polo <[email protected]>
Commit: Omar Polo <[email protected]>
implement conflicted-files
---
vc-got.el | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/vc-got.el b/vc-got.el
index 08d53c3..96163a5 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -106,7 +106,7 @@
;; - find-file-hook NOT IMPLEMENTED
;; - extra-menu NOT IMPLEMENTED
;; - extra-dir-menu NOT IMPLEMENTED
-;; - conflicted-files NOT IMPLEMENTED
+;; - conflicted-files DONE
;; - repository-url NOT IMPLEMENTED
;; TODO: use the idiom
@@ -615,5 +615,20 @@ Value is returned as floating point fractional number of
days."
(when (looking-at vc-got--commit-re)
(match-string-no-properties 1)))))
+(defun vc-got-conflicted-files (dir)
+ "Return the list of files with conflicts in directory DIR."
+ (let* ((root (vc-got-root dir))
+ (default-directory root)
+ (process-file-side-effects))
+ ;; for got it doesn't matter where we call "got status", it will
+ ;; always report file paths from the root of the repo.
+ (cl-loop with conflicts = nil
+ for (file . status) in (vc-got--parse-status-flag
+ (vc-got--status "."))
+ do (when (and (eq status 'conflict)
+ (file-in-directory-p file dir))
+ (push file conflicts))
+ finally return conflicts)))
+
(provide 'vc-got)
;;; vc-got.el ends here