X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4b72b4f91122704b805e2696b2e9342226359de0..b8ea08b037fb16395b90481162587706e71b487c:/lisp/vc/vc-svn.el diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index 5c87cab2d9..c5b817d252 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -1,6 +1,6 @@ ;;; vc-svn.el --- non-resident support for Subversion version-control -*- lexical-binding:t -*- -;; Copyright (C) 2003-2014 Free Software Foundation, Inc. +;; Copyright (C) 2003-2016 Free Software Foundation, Inc. ;; Author: FSF (see vc.el for full credits) ;; Maintainer: Stefan Monnier @@ -83,7 +83,7 @@ If t, use no switches." t ;`svn' doesn't support common args like -c or -b. "String or list of strings specifying extra switches for svn diff under VC. If nil, use the value of `vc-diff-switches' (or `diff-switches'), -together with \"-x --diff-cmd=\"`diff-command' (since 'svn diff' +together with \"-x --diff-cmd=\"`diff-command' (since `svn diff' does not support the default \"-c\" value of `diff-switches'). If you want to force an empty list of arguments, use t." :type '(choice (const :tag "Unspecified" nil) @@ -95,7 +95,18 @@ If you want to force an empty list of arguments, use t." :version "22.1" :group 'vc-svn) -(defcustom vc-svn-header '("\$Id\$") +(defcustom vc-svn-annotate-switches nil + "String or list of strings specifying switches for svn annotate under VC. +If nil, use the value of `vc-annotate-switches'. If t, use no +switches." + :type '(choice (const :tag "Unspecified" nil) + (const :tag "None" t) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string)) + :version "25.1" + :group 'vc-svn) + +(defcustom vc-svn-header '("$Id\ $") "Header keywords to be inserted by `vc-insert-headers'." :version "24.1" ; no longer consult the obsolete vc-header-alist :type '(repeat string) @@ -136,7 +147,8 @@ If you want to force an empty list of arguments, use t." (defun vc-svn-registered (file) "Check if FILE is SVN registered." (setq file (expand-file-name file)) - (when (vc-svn-root file) + (when (and (vc-svn-root file) + (file-accessible-directory-p (file-name-directory file))) (with-temp-buffer (cd (file-name-directory file)) (let* (process-file-side-effects @@ -164,6 +176,7 @@ If you want to force an empty list of arguments, use t." ;; FIXME it would be better not to have the "remote" argument, ;; but to distinguish the two output formats based on content. +;; FIXME: the local format isn't used by the (sole) caller anymore. (defun vc-svn-after-dir-status (callback &optional remote) (let ((state-map '((?A . added) (?C . conflict) @@ -208,7 +221,7 @@ CALLBACK is called as (CALLBACK RESULT BUFFER), where RESULT is a list of conses (FILE . STATE) for directory DIR." ;; FIXME shouldn't this rather default to all the files in dir? (apply #'vc-svn-command (current-buffer) 'async nil "status" "-u" files) - (vc-run-delayed (vc-svn-after-dir-status callback))) + (vc-run-delayed (vc-svn-after-dir-status callback t))) (defun vc-svn-dir-extra-headers (_dir) "Generate extra status headers for a Subversion working copy." @@ -267,7 +280,21 @@ RESULT is a list of conses (FILE . STATE) for directory DIR." ;; Expand default-directory because svn gets confused by eg ;; file://~/path/to/file. (Bug#15446). (vc-svn-command "*vc*" 0 "." "checkout" - (concat "file://" (expand-file-name default-directory) "SVN"))) + (let ((defdir (expand-file-name default-directory)) + (svn-prog (executable-find "svn"))) + (when (and (fboundp 'w32-application-type) + (eq (w32-application-type svn-prog) 'msys)) + (setq defdir + (replace-regexp-in-string "^\\(.\\):/" "/\\1/" + defdir))) + (concat (if (and (stringp defdir) + (eq (aref defdir 0) ?/)) + "file://" + ;; MS-Windows files d:/foo/bar need to + ;; begin with 3 leading slashes. + "file:///") + defdir + "SVN")))) (autoload 'vc-switches "vc") @@ -283,11 +310,14 @@ to the SVN command." (defalias 'vc-svn-responsible-p 'vc-svn-root) +(declare-function log-edit-extract-headers "log-edit" (headers string)) + (defun vc-svn-checkin (files comment &optional _extra-args-ignored) "SVN-specific version of `vc-backend-checkin'." (let ((status (apply 'vc-svn-command nil 1 files "ci" - (nconc (list "-m" comment) (vc-switches 'SVN 'checkin))))) + (nconc (cons "-m" (log-edit-extract-headers nil comment)) + (vc-switches 'SVN 'checkin))))) (set-buffer "*vc*") (goto-char (point-min)) (unless (equal status 0) @@ -374,6 +404,8 @@ FILE is a file wildcard, relative to the root directory of DIRECTORY." (unless contents-done (vc-svn-command nil 0 file "revert"))) +(autoload 'vc-read-revision "vc") + (defun vc-svn-merge-file (file) "Accept a file merge request, prompting for revisions." (let* ((first-revision @@ -660,7 +692,7 @@ and that it passes `vc-svn-global-switches' to it before FLAGS." ;; use conflict markers in which case we don't really know what to do. ;; So let's just punt for now. nil) - (message "There are unresolved conflicts in this file"))) + (vc-message-unresolved-conflicts buffer-file-name))) (defun vc-svn-parse-status (&optional filename) "Parse output of \"svn status\" command in the current buffer. @@ -735,7 +767,9 @@ Set file properties accordingly. If FILENAME is non-nil, return its status." ;; Support for `svn annotate' (defun vc-svn-annotate-command (file buf &optional rev) - (vc-svn-command buf 'async file "annotate" (if rev (concat "-r" rev)))) + (apply #'vc-svn-command buf 'async file "annotate" + (append (vc-switches 'svn 'annotate) + (if rev (list (concat "-r" rev)))))) (defun vc-svn-annotate-time-of-rev (rev) ;; Arbitrarily assume 10 commits per day.