From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#23436: [PATCH] Attemp to use the true name of a file to determine responsible vc if the genuine name does not work. Date: Mon, 31 Oct 2016 12:38:42 -0700 Message-ID: <87a8dkqpmo.fsf@topbug.net> References: <1462311145-5959-1-git-send-email-hong@topbug.net> <85f11f8a-1799-befd-3e5b-f7d7a6eac660@topbug.net> <072a649f-d11a-7c82-b3ae-32d9a92c8f8b@topbug.net> <5d653522-49bd-8b48-e3d6-0c09d1c65fae@yandex.ru> <377f4ee1-54a9-b10c-dc18-3acea6492bec@yandex.ru> <1ad97145-d21e-5d64-8b6c-4b4b2bc2ab49@yandex.ru> <87zilss0z6.fsf@topbug.net> <87funefz1i.fsf@topbug.net> <83twbtq03k.fsf@gnu.org> <87vaw9bgdr.fsf@topbug.net> <83h97splqk.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1477942777 22165 195.159.176.226 (31 Oct 2016 19:39:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2016 19:39:37 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.8 Cc: dgutov@yandex.ru, 23436@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 31 20:39:33 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1IQN-0003SD-GA for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2016 20:39:15 +0100 Original-Received: from localhost ([::1]:38215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1IQQ-0003lD-59 for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2016 15:39:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1IQD-0003is-QF for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 15:39:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1IQA-0003PR-Ki for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 15:39:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1IQA-0003PN-HM for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 15:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c1IQA-0006dC-CT for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 15:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2016 19:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23436 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23436-submit@debbugs.gnu.org id=B23436.147794273625476 (code B ref 23436); Mon, 31 Oct 2016 19:39:02 +0000 Original-Received: (at 23436) by debbugs.gnu.org; 31 Oct 2016 19:38:56 +0000 Original-Received: from localhost ([127.0.0.1]:38334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1IQ3-0006cq-UH for submit@debbugs.gnu.org; Mon, 31 Oct 2016 15:38:56 -0400 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1IQ2-0006cf-Bj for 23436@debbugs.gnu.org; Mon, 31 Oct 2016 15:38:54 -0400 Original-Received: from localhost (guest-wireless-207-151-035-036.usc.edu [207.151.35.36]) by mx.zohomail.com with SMTPS id 1477942725265339.6286850926175; Mon, 31 Oct 2016 12:38:45 -0700 (PDT) In-reply-to: <83h97splqk.fsf@gnu.org> X-Zoho-Virus-Status: 1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125184 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain On 2016-10-31 Mon 08:43 GMT-0700, Eli Zaretskii wrote: > > The node "Truenames" sounds like a good place. > Added in the new patch now (along with the change of the previous version). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-doc-2.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1 index 3f746ebd763f..c5d150af8124 100644 =2D-- a/doc/emacs/ChangeLog.1 +++ b/doc/emacs/ChangeLog.1 @@ -1,3 +1,8 @@ +2016-10-30 Hong Xu + + * maintaining.texi (Version Control Systems): Mention + `vc-responsible-backend' when explaining VC back ends. + 2015-03-29 Dani Moncayo =20 * files.texi (Diff Mode): Doc fix. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index aca29910b7d3..884d40be5634 100644 =2D-- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -223,7 +223,7 @@ Version Control Systems @cindex SRC @cindex src @item =2DSRC (src) is RCS, reloaded - a specialized version-control system +SRC (src) is RCS, reloaded---a specialized version-control system designed for single-file projects worked on by only one person. It allows multiple files with independent version-control histories to exist in one directory, and is thus particularly well suited for @@ -233,6 +233,10 @@ Version Control Systems supports almost all SRC operations. @end itemize =20 +@findex vc-responsible-backend +To determine which back end is in charge of a file, the function +@code{vc-responsible-backend} can be used. + @node VCS Concepts @subsubsection Concepts of Version Control =20 diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1 index 610e7541e7de..2d00ac7e7d32 100644 =2D-- a/doc/lispref/ChangeLog.1 +++ b/doc/lispref/ChangeLog.1 @@ -1,3 +1,8 @@ +2016-10-31 Hong Xu + + * files.texi (Truenames): Add documentation for + `vc-responsible-backend'. + 2015-03-29 Glenn Morris =20 * objects.texi (Equality Predicates): Fix typo in example. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 6b7ee19d5f39..0be8b83831b2 100644 =2D-- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1138,6 +1138,21 @@ Truenames name an existing directory, the return value is @code{nil}. @end defun =20 +@defun vc-responsible-backend file +This function determines the responsible VC backend of the given +@var{file}. For example, if @file{emacs.c} is a file tracked by git, +@code{(vc-responsible-backend "emacs.c")} returns @samp{Git}. Note +that if @var{file} is a symbolic link, @code{vc-responsible-backend} +will not resolve it---the backend of the symbolic link file itself is +reported. Instead, to get the backend VC of the file to which +@var{file} refers, wrap @var{file} with a symbolic link resolving +function such as @code{file-chase-links}: + +@smallexample +(vc-responsible-backend (file-chase-links "emacs.c")) +@end smallexample +@end defun + @node File Attributes @subsection File Attributes @cindex file attributes diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index ac020d095397..2ddf4e19e1f7 100644 =2D-- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -959,7 +959,11 @@ vc-responsible-backend If FILE is already registered, return the backend of FILE. If FILE is not registered, then the first backend in `vc-handled-backends' that declares itself =2Dresponsible for FILE is returned." +responsible for FILE is returned. + +Note that if FILE is a symbolic link, it will not be resolved -- +the responsible backend system for the symbolic link itself will +be reported." (or (and (not (file-directory-p file)) (vc-backend file)) (catch 'found ;; First try: find a responsible backend. If this is for registration, --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJYF53CAAoJECZsfTOCL4R4Ow0P/jO9+ZpugtNQ79pX/Oab2xKz COW0ld+Qs4NXmNwZL7DRL9NqXEbbRrB5e0apl/7MkfWkn9ALTg2UyOw5rjeY2QPK s2QYW0ABFS49zMxVL72HILMyxgp7mK8rg23kxWiW/lF/XwsyxKq7bOtI4m6ON0Ux VB7mWWTeC/gv+TRkzfhU1WVDp/vqSFvBnM+E+YZGGjAG4ZM8VHj/7OOncunCrDQF CF1ca2qUpQOWqtqDsq7XummrPDyiwMlMcl6fJERoapFkQVB2g6CrdyKAciYIvvfH Yk4oK2oZTZfe9E+EmE6T+8sG/AXCtKbNkXm0BTgzv3ZwT6NiiKSLIC7qbqWx8IMC q8sXOGEgnPfjJeNxqXE+qVPa3QUC7dL7s59RpE0kpUzB3wGw3PlKqS0Oog9+jH4y DnIVNS+Ficzup+VlV6PsKBOIriB3BV1qr6VsDZYEJljKd55x2pN6BBnndHtr6aD0 ocDtyH1VocfpDxLRJXFEL3SYopEyGCbGlCfqhKL0X8ZYOlSjaHU/0TTdIJzZDhF+ I/Ys1z7C5XdB6Uh2XD8kGIsnuMdz8qzG2SLjmUSMmzmq+okRaamTYs/75VwKxLyu y3aKAUfPuTg0FMmwwjooLZxvOam5tsMOtMsG07BRYtmeDH3M5sRKb2ujEGgcp04E V+SDMVdDXbd5Ul+4ddiE =aAmB -----END PGP SIGNATURE----- --==-=-=--