]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-svn.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / vc / vc-svn.el
index b8a6a326ec187dabf5a2d6b6d96d0bec759eec9d..b79af07a756e0c4f2f2b46074c2d5785970a2401 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control
 
-;; Copyright (C) 2003-201 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2013 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
 ;;; Customization options
 ;;;
 
+(defgroup vc-svn nil
+  "VC Subversion (svn) backend."
+  :version "24.1"
+  :group 'vc)
+
 ;; FIXME there is also svnadmin.
 (defcustom vc-svn-program "svn"
   "Name of the SVN executable."
   :type 'string
-  :group 'vc)
+  :group 'vc-svn)
 
 (defcustom vc-svn-global-switches nil
   "Global switches to pass to any SVN command."
@@ -53,7 +58,7 @@
                         :value ("")
                         string))
   :version "22.1"
-  :group 'vc)
+  :group 'vc-svn)
 
 (defcustom vc-svn-register-switches nil
   "Switches for registering a file into SVN.
@@ -65,7 +70,7 @@ If t, use no switches."
                 (string :tag "Argument String")
                 (repeat :tag "Argument List" :value ("") string))
   :version "22.1"
-  :group 'vc)
+  :group 'vc-svn)
 
 (defcustom vc-svn-diff-switches
   t                       ;`svn' doesn't support common args like -c or -b.
@@ -81,13 +86,13 @@ If you want to force an empty list of arguments, use t."
                         :value ("")
                         string))
   :version "22.1"
-  :group 'vc)
+  :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)
-  :group 'vc)
+  :group 'vc-svn)
 
 ;; We want to autoload it for use by the autoloaded version of
 ;; vc-svn-registered, but we want the value to be compiled at startup, not
@@ -150,9 +155,24 @@ If you want to force an empty list of arguments, use t."
       (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
       (vc-svn-parse-status file))))
 
+;; NB this does not handle svn properties, which can be changed
+;; without changing the file timestamp.
+;; Note that unlike vc-cvs-state-heuristic, this is not called from
+;; vc-svn-state.  AFAICS, it is only called from vc-state-refresh via
+;; vc-after-save (bug#7850).  Therefore the fact that it ignores
+;; properties is irrelevant.  If you want to make vc-svn-state call
+;; this, it should be extended to handle svn properties.
 (defun vc-svn-state-heuristic (file)
   "SVN-specific state heuristic."
-  (vc-svn-state file 'local))
+  ;; If the file has not changed since checkout, consider it `up-to-date'.
+  ;; Otherwise consider it `edited'.  Copied from vc-cvs-state-heuristic.
+  (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
+        (lastmod (nth 5 (file-attributes file))))
+    (cond
+     ((equal checkout-time lastmod) 'up-to-date)
+     ((string= (vc-working-revision file) "0") 'added)
+     ((null checkout-time) 'unregistered)
+     (t 'edited))))
 
 ;; FIXME it would be better not to have the "remote" argument,
 ;; but to distinguish the two output formats based on content.
@@ -394,7 +414,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
                ;; We also used to match the filename in column 0 without any
                ;; meta-info before it, but I believe this can never happen.
                (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)?  \\)"
-                       (regexp-quote (file-name-nondirectory file)))
+                      (regexp-quote (file-relative-name file)))
                nil t)
               (cond
                ;; Merge successful, we are in sync with repository now