From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: VC repository-url command (was: RFC: Automatic setup for bug-reference-mode) Date: Mon, 15 Jun 2020 08:23:45 +0200 Message-ID: <875zbssv7y.fsf_-_@gnu.org> References: <87r1uihtsu.fsf@gnu.org> <87h7vd3cbs.fsf@gnu.org> <87tuzdsj8d.fsf@gnu.org> <87tuzd755z.fsf@gnu.org> <401bed41-3eb1-3049-2037-a9f2b8ac385c@yandex.ru> <877dw9qs1c.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="49886"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, Stefan Monnier , Dmitry Gutov To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 15 08:24:22 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkiXd-000Cta-4R for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Jun 2020 08:24:21 +0200 Original-Received: from localhost ([::1]:52166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkiXc-0003RU-5L for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Jun 2020 02:24:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkiX8-0002zC-L3 for emacs-devel@gnu.org; Mon, 15 Jun 2020 02:23:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59405) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkiX7-0002SX-Aw; Mon, 15 Jun 2020 02:23:49 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:50605) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1jkiX6-0004ZB-UL; Mon, 15 Jun 2020 02:23:49 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 9D89C27C0054; Mon, 15 Jun 2020 02:23:48 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 15 Jun 2020 02:23:48 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeijedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe dtleeiffekueffudeufeefhfeitdejuedtueevgeffgfdtjeelkeehgeekteekveenucfk phepleefrddvfeeirddufeehrdeljeenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgr lhhithihqdekieejfeekjeekgedqieefhedvleekqdhtshguhheppehgnhhurdhorhhgse hfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: from thinkpad-t440p (p5dec8761.dip0.t-ipconnect.de [93.236.135.97]) by mail.messagingengine.com (Postfix) with ESMTPA id B6C853060F09; Mon, 15 Jun 2020 02:23:46 -0400 (EDT) Mail-Followup-To: "Basil L. Contovounesios" , Dmitry Gutov , Stefan Monnier , emacs-devel@gnu.org In-Reply-To: <877dw9qs1c.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 14 Jun 2020 22:03:11 +0100") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252256 Archived-At: "Basil L. Contovounesios" writes: >>> (defun vc-git-repository-url (file-or-dir) >>> (let ((default-directory (vc-git-root file-or-dir))) >>> (with-temp-buffer >>> (vc-git-command (current-buffer) 0 nil "remote" "get-url" "origin") >>> (buffer-substring-no-properties (point-min) (1- (point-max)))))) >>> where I explicitly name the remote "origin" (which, I know, doesn't need >>> to exist but still works in 99% of all cases). >> >> Sounds good! >> >> If the new version can be used in vc-git-dir-extra-headers, could you >> please make it so? I'll have a look. >> That aside, I was going to ask whether the new backend method should >> take a "remote-name" argument, but I don't know how many backends >> support different remotes. Or what other actual code is going to use >> this method anyway. I guess all distributed VCS do in some form or another. With Hg, I currently return the value of paths.default which could also be paths.other-remote. With Bzr, I think there's no such concept but each branch is bound to some "parent branch" which is usually the URL from where you cloned from. > It would definitely be nice to somehow make this configurable. For > example in my local Emacs checkout I have Savannah as the "upstream" > remote, and my mirror on GitLab as the "origin" remote, because that's > where I push to most of the time. I usually do the opposite: origin is the original project and tsdh is my fork which I set as push-remote. So I think I'll add an optional remote-name argument as suggested by Dmitry that overrides "origin" for Git and "default" for Hg while being ignored by the other supported backends SVN and Bzr. Then I could also add "default remote" defvars (or defcustoms?) for Git and Hg which are used if no remote-name was explicitly provided as suggested by you. As for the original task I want to implement, i.e., bug-reference auto-setup, I'd actually want to get the remote's URL which actually hosts the bug tracker (thinking of GitLab/GitHub repos and their forks). So probably there I should try likely remote names such as "upstream" before falling back to "origin"... Bye, Tassilo