[Top][All Lists]

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

master 2e80328: Add optional remote-name argument to VC repository-url c

From: Tassilo Horn
Subject: master 2e80328: Add optional remote-name argument to VC repository-url command
Date: Mon, 15 Jun 2020 02:59:04 -0400 (EDT)

branch: master
commit 2e80328ba683e6205cd65bd3fb69da2563183e66
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Add optional remote-name argument to VC repository-url command
    * lisp/vc/vc.el: Document new remote-name argument of VC
    repository-url command.
    * lisp/vc/vc-git.el (vc-git-repository-url): Add and use new arg.
    * lisp/vc/vc-hg.el (vc-hg-repository-url): Add and use new arg.
    * lisp/vc/vc-bzr.el (vc-bzr-repository-url): Add new arg but ignore
    * lisp/vc/vc-svn.el (vc-svn-repository-url): Add new arg but ignore
 lisp/vc/vc-bzr.el | 2 +-
 lisp/vc/vc-git.el | 5 +++--
 lisp/vc/vc-hg.el  | 5 +++--
 lisp/vc/vc-svn.el | 2 +-
 lisp/vc/vc.el     | 7 +++++--
 5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 21c7e7c..f98730e 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -1316,7 +1316,7 @@ stream.  Standard error output is discarded."
                             string pred)))))
-(defun vc-bzr-repository-url (file-or-dir)
+(defun vc-bzr-repository-url (file-or-dir &optional _remote-name)
   (let ((default-directory (vc-bzr-root file-or-dir)))
       (vc-bzr-command "info" (current-buffer) 0 nil)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 261e4c7..636f9df 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1083,10 +1083,11 @@ This prompts for a branch to merge from."
                                 "DU" "AA" "UU"))
             (push (expand-file-name file directory) files)))))))
-(defun vc-git-repository-url (file-or-dir)
+(defun vc-git-repository-url (file-or-dir &optional remote-name)
   (let ((default-directory (vc-git-root file-or-dir)))
-      (vc-git-command (current-buffer) 0 nil "remote" "get-url" "origin")
+      (vc-git-command (current-buffer) 0 nil "remote" "get-url"
+                      (or remote-name "origin"))
       (buffer-substring-no-properties (point-min) (1- (point-max))))))
 ;; Everywhere but here, follows vc-git-command, which uses vc-do-command
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 25ca4ed..95ced7b 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1525,11 +1525,12 @@ This function differs from vc-do-command in that it 
 (defun vc-hg-root (file)
   (vc-find-root file ".hg"))
-(defun vc-hg-repository-url (file-or-dir)
+(defun vc-hg-repository-url (file-or-dir &optional remote-name)
   (let ((default-directory (vc-hg-root file-or-dir)))
       (vc-hg-command (current-buffer) 0 nil
-                     "config" "paths.default")
+                     "config"
+                     (concat "paths." (or remote-name "default")))
       (buffer-substring-no-properties (point-min) (1- (point-max))))))
 (provide 'vc-hg)
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 6ab07c1..e108b3a 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -818,7 +818,7 @@ Set file properties accordingly.  If FILENAME is non-nil, 
return its status."
           (setq loglines (buffer-substring-no-properties start (point-max)))))
-(defun vc-svn-repository-url (file-or-dir)
+(defun vc-svn-repository-url (file-or-dir &optional _remote-name)
   (let ((default-directory (vc-svn-root file-or-dir)))
       (vc-svn-command (current-buffer) 0 nil
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 5c335eb..ce947d2 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -554,9 +554,12 @@
 ;;   the project that contains DIR.
 ;;   FIXME: what should it do with non-text conflicts?
-;; - repository-url (file)
+;; - repository-url (file-or-dir &optional remote-name)
-;;   Returns the URL of the repository of the current checkout.
+;;   Returns the URL of the repository of the current checkout
+;;   containing FILE-OR-DIR.  The optional REMOTE-NAME specifies the
+;;   remote (in Git parlance) whose URL is to be returned.  It has
+;;   only a meaning for distributed VCS and is ignored otherwise.
 ;;; Changes from the pre-25.1 API:

reply via email to

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