branch: externals/vc-got
commit 694534b48d699ecab2e671833fdaf60e752bd29b
Author: Omar Polo <[email protected]>
Commit: Omar Polo <[email protected]>
implemented vc-got-mode-line-string
---
vc-got.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/vc-got.el b/vc-got.el
index 860a9a2..ced238f 100644
--- a/vc-got.el
+++ b/vc-got.el
@@ -45,7 +45,7 @@
;; - status-fileinfo-extra NOT IMPLEMENTED
;; * working-revision DONE
;; * checkout-model DONE
-;; - mode-line-string NOT IMPLEMENTED
+;; - mode-line-string DONE
;;
;; STATE-CHANGING FUNCTIONS:
;; * create-repo NOT IMPLEMENTED
@@ -246,8 +246,11 @@ DIR-OR-FILE."
(move-beginning-of-line nil)
`(,branchname . ,commit))))))
-;; (vc-got-with-worktree "/usr/ports/mystuff/"
-;; (vc-got--list-branches))
+(defun vc-got--current-branch ()
+ "Return the current branch."
+ (with-temp-buffer
+ (when (zerop (vc-got--call "branch"))
+ (string-trim (buffer-string) "" "\n"))))
(defun vc-got--integrate (branch)
"Integrate BRANCH into the current one."
@@ -356,6 +359,12 @@ DIR-OR-FILE."
(defun vc-got-checkout-model (_files)
'implicit)
+(defun vc-got-mode-line-string (file)
+ "Return the VC mode line string for FILE."
+ (vc-got-with-worktree file
+ (let ((def (vc-default-mode-line-string 'Got file)))
+ (concat (substring def 0 4) (vc-got--current-branch)))))
+
;; state-changing functions