diff options
| author | Tassilo Horn | 2020-06-14 18:24:14 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2020-06-14 21:37:26 +0200 |
| commit | 4f92cf14f395577572d451c0488ade952bc3cbaa (patch) | |
| tree | 820eed49dd74aeb028c962adfb221b9a3ff922e3 | |
| parent | e96f78fca672c74b7bf1120b7683a50295418725 (diff) | |
| download | emacs-4f92cf14f395577572d451c0488ade952bc3cbaa.tar.gz emacs-4f92cf14f395577572d451c0488ade952bc3cbaa.zip | |
Add new VC command `repository-url'
* lisp/vc/vc.el: Document repository-url command.
* lisp/vc/vc-bzr.el (vc-bzr-repository-url): New defun.
* lisp/vc/vc-git.el (vc-git-repository-url): New defun.
* lisp/vc/vc-hg.el (vc-hg-repository-url): New defun.
* lisp/vc/vc-svn.el (vc-svn-repository-url): New defun.
| -rw-r--r-- | lisp/vc/vc-bzr.el | 9 | ||||
| -rw-r--r-- | lisp/vc/vc-git.el | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-svn.el | 9 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 4 |
5 files changed, 35 insertions, 1 deletions
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index e5d307e7ede..21c7e7cfab1 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el | |||
| @@ -1316,6 +1316,15 @@ stream. Standard error output is discarded." | |||
| 1316 | vc-bzr-revision-keywords)) | 1316 | vc-bzr-revision-keywords)) |
| 1317 | string pred))))) | 1317 | string pred))))) |
| 1318 | 1318 | ||
| 1319 | (defun vc-bzr-repository-url (file-or-dir) | ||
| 1320 | (let ((default-directory (vc-bzr-root file-or-dir))) | ||
| 1321 | (with-temp-buffer | ||
| 1322 | (vc-bzr-command "info" (current-buffer) 0 nil) | ||
| 1323 | (goto-char (point-min)) | ||
| 1324 | (if (re-search-forward "parent branch: \\(.*\\)$" nil t) | ||
| 1325 | (match-string 1) | ||
| 1326 | (error "Cannot determine Bzr repository URL"))))) | ||
| 1327 | |||
| 1319 | (provide 'vc-bzr) | 1328 | (provide 'vc-bzr) |
| 1320 | 1329 | ||
| 1321 | ;;; vc-bzr.el ends here | 1330 | ;;; vc-bzr.el ends here |
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index dcb52282656..261e4c7aa47 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -101,6 +101,7 @@ | |||
| 101 | ;; - rename-file (old new) OK | 101 | ;; - rename-file (old new) OK |
| 102 | ;; - find-file-hook () OK | 102 | ;; - find-file-hook () OK |
| 103 | ;; - conflicted-files OK | 103 | ;; - conflicted-files OK |
| 104 | ;; - repository-url (file-or-dir) OK | ||
| 104 | 105 | ||
| 105 | ;;; Code: | 106 | ;;; Code: |
| 106 | 107 | ||
| @@ -1082,6 +1083,12 @@ This prompts for a branch to merge from." | |||
| 1082 | "DU" "AA" "UU")) | 1083 | "DU" "AA" "UU")) |
| 1083 | (push (expand-file-name file directory) files))))))) | 1084 | (push (expand-file-name file directory) files))))))) |
| 1084 | 1085 | ||
| 1086 | (defun vc-git-repository-url (file-or-dir) | ||
| 1087 | (let ((default-directory (vc-git-root file-or-dir))) | ||
| 1088 | (with-temp-buffer | ||
| 1089 | (vc-git-command (current-buffer) 0 nil "remote" "get-url" "origin") | ||
| 1090 | (buffer-substring-no-properties (point-min) (1- (point-max)))))) | ||
| 1091 | |||
| 1085 | ;; Everywhere but here, follows vc-git-command, which uses vc-do-command | 1092 | ;; Everywhere but here, follows vc-git-command, which uses vc-do-command |
| 1086 | ;; from vc-dispatcher. | 1093 | ;; from vc-dispatcher. |
| 1087 | (autoload 'vc-resynch-buffer "vc-dispatcher") | 1094 | (autoload 'vc-resynch-buffer "vc-dispatcher") |
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 40d75738063..25ca4ed55fd 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el | |||
| @@ -1525,6 +1525,13 @@ This function differs from vc-do-command in that it invokes | |||
| 1525 | (defun vc-hg-root (file) | 1525 | (defun vc-hg-root (file) |
| 1526 | (vc-find-root file ".hg")) | 1526 | (vc-find-root file ".hg")) |
| 1527 | 1527 | ||
| 1528 | (defun vc-hg-repository-url (file-or-dir) | ||
| 1529 | (let ((default-directory (vc-hg-root file-or-dir))) | ||
| 1530 | (with-temp-buffer | ||
| 1531 | (vc-hg-command (current-buffer) 0 nil | ||
| 1532 | "config" "paths.default") | ||
| 1533 | (buffer-substring-no-properties (point-min) (1- (point-max)))))) | ||
| 1534 | |||
| 1528 | (provide 'vc-hg) | 1535 | (provide 'vc-hg) |
| 1529 | 1536 | ||
| 1530 | ;;; vc-hg.el ends here | 1537 | ;;; vc-hg.el ends here |
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index d039bf3c6a3..6ab07c1476d 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el | |||
| @@ -816,7 +816,14 @@ Set file properties accordingly. If FILENAME is non-nil, return its status." | |||
| 816 | (push (match-string 1 loglines) vc-svn-revisions) | 816 | (push (match-string 1 loglines) vc-svn-revisions) |
| 817 | (setq start (+ start (match-end 0))) | 817 | (setq start (+ start (match-end 0))) |
| 818 | (setq loglines (buffer-substring-no-properties start (point-max))))) | 818 | (setq loglines (buffer-substring-no-properties start (point-max))))) |
| 819 | vc-svn-revisions))) | 819 | vc-svn-revisions))) |
| 820 | |||
| 821 | (defun vc-svn-repository-url (file-or-dir) | ||
| 822 | (let ((default-directory (vc-svn-root file-or-dir))) | ||
| 823 | (with-temp-buffer | ||
| 824 | (vc-svn-command (current-buffer) 0 nil | ||
| 825 | "info" "--show-item" "repos-root-url") | ||
| 826 | (buffer-substring-no-properties (point-min) (1- (point-max)))))) | ||
| 820 | 827 | ||
| 821 | (provide 'vc-svn) | 828 | (provide 'vc-svn) |
| 822 | 829 | ||
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c640ba0420e..5c335ebfaa2 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -553,6 +553,10 @@ | |||
| 553 | ;; Return the list of files where conflict resolution is needed in | 553 | ;; Return the list of files where conflict resolution is needed in |
| 554 | ;; the project that contains DIR. | 554 | ;; the project that contains DIR. |
| 555 | ;; FIXME: what should it do with non-text conflicts? | 555 | ;; FIXME: what should it do with non-text conflicts? |
| 556 | ;; | ||
| 557 | ;; - repository-url (file) | ||
| 558 | ;; | ||
| 559 | ;; Returns the URL of the repository of the current checkout. | ||
| 556 | 560 | ||
| 557 | ;;; Changes from the pre-25.1 API: | 561 | ;;; Changes from the pre-25.1 API: |
| 558 | ;; | 562 | ;; |