unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Hong Xu <hong@topbug.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dgutov@yandex.ru, 23436@debbugs.gnu.org
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	[thread overview]
Message-ID: <87a8dkqpmo.fsf@topbug.net> (raw)
In-Reply-To: <83h97splqk.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 202 bytes --]


On 2016-10-31 Mon 08:43 GMT-0700, Eli Zaretskii <eliz@gnu.org> wrote:
>
> The node "Truenames" sounds like a good place.
>

Added in the new patch now (along with the change of the previous version).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: vc-doc-2.patch --]
[-- Type: text/x-diff, Size: 3519 bytes --]

diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1
index 3f746ebd763f..c5d150af8124 100644
--- a/doc/emacs/ChangeLog.1
+++ b/doc/emacs/ChangeLog.1
@@ -1,3 +1,8 @@
+2016-10-30  Hong Xu  <hong@topbug.net>
+
+	* maintaining.texi (Version Control Systems): Mention
+	`vc-responsible-backend' when explaining VC back ends.
+
 2015-03-29  Dani Moncayo  <dmoncayo@gmail.com>
 
 	* files.texi (Diff Mode): Doc fix.
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index aca29910b7d3..884d40be5634 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -223,7 +223,7 @@ Version Control Systems
 @cindex SRC
 @cindex src
 @item
-SRC (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
 
+@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
 
diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1
index 610e7541e7de..2d00ac7e7d32 100644
--- a/doc/lispref/ChangeLog.1
+++ b/doc/lispref/ChangeLog.1
@@ -1,3 +1,8 @@
+2016-10-31  Hong Xu  <hong@topbug.net>
+
+	* files.texi (Truenames): Add documentation for
+	`vc-responsible-backend'.
+
 2015-03-29  Glenn Morris  <rgm@gnu.org>
 
 	* objects.texi (Equality Predicates): Fix typo in example.
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 6b7ee19d5f39..0be8b83831b2 100644
--- 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
 
+@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
--- 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
-responsible 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,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2016-10-31 19:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 21:32 bug#23436: [PATCH] Use the true name of a file to determine responsible vc Hong Xu
2016-10-19 19:19 ` Hong Xu
2016-10-19 19:33   ` bug#23436: [PATCH] Attemp to use the true name of a file to determine responsible vc if the genuine name does not work Hong Xu
2016-10-19 23:37     ` Dmitry Gutov
2016-10-19 23:49       ` Hong Xu
2016-10-19 23:58         ` Dmitry Gutov
2016-10-20  0:16           ` Hong Xu
2016-10-20  6:58             ` Eli Zaretskii
2016-10-20  7:21               ` Hong Xu
2016-10-20  8:23                 ` Eli Zaretskii
2016-10-20  8:50                   ` Dmitry Gutov
2016-10-20  9:46                   ` Andreas Schwab
2016-10-20 10:02                     ` Eli Zaretskii
2016-10-20 10:58                       ` Eli Zaretskii
2016-10-20  9:47             ` Dmitry Gutov
2016-10-20 16:39               ` Hong Xu
2016-10-20 22:34                 ` Dmitry Gutov
2016-10-20 23:04                   ` Hong Xu
2016-10-24 23:41                     ` Dmitry Gutov
2016-10-25 19:05                       ` Hong Xu
2016-10-25 23:12                         ` Dmitry Gutov
2016-10-30  0:42                           ` Hong Xu
2016-10-30 16:21                             ` Eli Zaretskii
2016-10-30 22:50                               ` Hong Xu
2016-10-31 15:43                                 ` Eli Zaretskii
2016-10-31 19:38                                   ` Hong Xu [this message]
2016-11-01 18:47                                     ` Eli Zaretskii
2016-11-04  7:46                                       ` Hong Xu
2016-11-04 10:08                                         ` Eli Zaretskii
2016-10-31 11:34                             ` Dmitry Gutov
2016-10-31 19:24                               ` Hong Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8dkqpmo.fsf@topbug.net \
    --to=hong@topbug.net \
    --cc=23436@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).