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

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

[elpa] externals/vc-got 8b635a9 054/145: implement repository-url


From: ELPA Syncer
Subject: [elpa] externals/vc-got 8b635a9 054/145: implement repository-url
Date: Thu, 9 Sep 2021 15:58:32 -0400 (EDT)

branch: externals/vc-got
commit 8b635a9f0f8c22640d8e129df31a514deace0679
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    implement repository-url
---
 vc-got.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/vc-got.el b/vc-got.el
index 96163a5..81c60b3 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -107,7 +107,7 @@
 ;; - extra-menu                         NOT IMPLEMENTED
 ;; - extra-dir-menu                     NOT IMPLEMENTED
 ;; - conflicted-files                   DONE
-;; - repository-url                     NOT IMPLEMENTED
+;; - repository-url                     DONE
 
 ;; TODO: use the idiom
 ;;      (let (process-file-side-effects) ...)
@@ -630,5 +630,22 @@ Value is returned as floating point fractional number of 
days."
                   (push file conflicts))
              finally return conflicts)))
 
+(defun vc-got-repository-url (_file &optional remote-name)
+  "Return URL for REMOTE-NAME, or for \"origin\" if nil."
+  (let* ((default-directory (vc-got--repo-root))
+         (remote-name (or remote-name "origin"))
+         (heading (concat "[remote \"" remote-name "\"]"))
+         found)
+    (with-temp-buffer
+      (insert-file-contents "config")
+      (goto-char (point-min))
+      (when (search-forward heading nil t)
+        (forward-line)
+        (while (and (not found)
+                    (looking-at ".*="))       ;too broad?
+          (when (looking-at ".*url = \\(.*\\)")
+            (setq found (match-string-no-properties 1))))
+        found))))
+
 (provide 'vc-got)
 ;;; vc-got.el ends here



reply via email to

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