[Top][All Lists]

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

bug#23436: [PATCH] Attemp to use the true name of a file to determine re

From: Hong Xu
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
User-agent: mu4e 0.9.17; emacs

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

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

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  <address@hidden>
+       * maintaining.texi (Version Control Systems): Mention
+       `vc-responsible-backend' when explaining VC back ends.
 2015-03-29  Dani Moncayo  <address@hidden>
        * 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
-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
address@hidden vc-responsible-backend
+To determine which back end is in charge of a file, the function
address@hidden 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  <address@hidden>
+       * files.texi (Truenames): Add documentation for
+       `vc-responsible-backend'.
 2015-03-29  Glenn Morris  <address@hidden>
        * 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
address@hidden vc-responsible-backend file
+This function determines the responsible VC backend of the given
address@hidden  For example, if @file{emacs.c} is a file tracked by git,
address@hidden(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
address@hidden refers, wrap @var{file} with a symbolic link resolving
+function such as @code{file-chase-links}:
+(vc-responsible-backend (file-chase-links "emacs.c"))
address@hidden smallexample
address@hidden 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: signature.asc
Description: PGP signature

reply via email to

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