]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-hooks.el
Move comment for last change to right place.
[gnu-emacs] / lisp / vc-hooks.el
index ed44eba3498fac20cdb0de5328f05457a2bc82cf..91cb4c0cd32754b16110ad498126ee6bee41e1b3 100644 (file)
@@ -559,13 +559,16 @@ and does not employ any heuristic at all."
   "Return non-nil if FILE has not changed since the last checkout."
   (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
         (lastmod (nth 5 (file-attributes file))))
+    ;; This is a shortcut for determining when the workfile is
+    ;; unchanged.  It can fail under some circumstances; see the
+    ;; discussion in bug#694.
     (if (and checkout-time
-             ;; Tramp and Ange-FTP return this when they don't know the time.
-             (not (equal lastmod '(0 0))))
-        (equal checkout-time lastmod)
+            ;; Tramp and Ange-FTP return this when they don't know the time.
+            (not (equal lastmod '(0 0))))
+       (equal checkout-time lastmod)
       (let ((unchanged (vc-call workfile-unchanged-p file)))
-        (vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0))
-        unchanged))))
+       (vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0))
+       unchanged))))
 
 (defun vc-default-workfile-unchanged-p (backend file)
   "Check if FILE is unchanged by diffing against the master version.
@@ -597,8 +600,6 @@ If FILE is not registered, this function always returns nil."
 ;; Backward compatibility.
 (define-obsolete-function-alias
   'vc-workfile-version 'vc-working-revision "23.1")
-(define-obsolete-function-alias
-  'vc-previous-version 'vc-previous-revision "23.1")
 (defun vc-default-working-revision (backend file)
   (message
    "`working-revision' not found: using the old `workfile-version' instead")
@@ -745,7 +746,7 @@ Before doing that, check if there are any old backups and get rid of them."
            (vc-call-backend backend 'make-version-backups-p file)
            (vc-make-version-backup file)))))
 
-(declare-function vc-directory-resynch-file "vc-dispatcher" (&optional fname))
+(declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
 
 (defun vc-after-save ()
   "Function to be called by `basic-save-buffer' (in files.el)."
@@ -766,10 +767,10 @@ Before doing that, check if there are any old backups and get rid of them."
          (eq (vc-checkout-model backend (list file)) 'implicit)
          (vc-file-setprop file 'vc-state 'edited)
         (vc-mode-line file)
-        (when (featurep 'vc)
-          ;; If VC is not loaded, then there can't be
-          ;; any directory buffer to synchronize.
-          (vc-directory-resynch-file file)))))
+        ;; Try to avoid unnecessary work, a *vc-dir* buffer is only
+        ;; present if this is true.
+        (when (memq 'vc-dir-resynch-file after-save-hook)
+          (vc-dir-resynch-file file)))))
 
 (defvar vc-menu-entry
   '(menu-item "Version Control" vc-menu-map
@@ -819,9 +820,9 @@ visiting FILE."
       ;; If the user is root, and the file is not owner-writable,
       ;; then pretend that we can't write it
       ;; even though we can (because root can write anything).
-    ;; This way, even root cannot modify a file that isn't locked.
-    (and (equal file buffer-file-name)
-        (not buffer-read-only)
+      ;; This way, even root cannot modify a file that isn't locked.
+      (and (equal file buffer-file-name)
+          (not buffer-read-only)
           (zerop (user-real-uid))
           (zerop (logand (file-modes buffer-file-name) 128))
           (setq buffer-read-only t)))
@@ -981,8 +982,8 @@ Used in `find-file-not-found-functions'."
     (define-key map "i" 'vc-register)
     (define-key map "l" 'vc-print-log)
     (define-key map "m" 'vc-merge)
-    (define-key map "r" 'vc-retrieve-snapshot)
-    (define-key map "s" 'vc-create-snapshot)
+    (define-key map "r" 'vc-retrieve-tag)
+    (define-key map "s" 'vc-create-tag)
     (define-key map "u" 'vc-revert)
     (define-key map "v" 'vc-next-action)
     (define-key map "+" 'vc-update)
@@ -996,12 +997,12 @@ Used in `find-file-not-found-functions'."
   (let ((map (make-sparse-keymap "Version Control")))
     ;;(define-key map [show-files]
     ;;  '("Show Files under VC" . (vc-directory t)))
-    (define-key map [vc-retrieve-snapshot]
-      '(menu-item "Retrieve Snapshot" vc-retrieve-snapshot
-                 :help "Retrieve snapshot"))
-    (define-key map [vc-create-snapshot]
-      '(menu-item "Create Snapshot" vc-create-snapshot
-                 :help "Create Snapshot"))
+    (define-key map [vc-retrieve-tag]
+      '(menu-item "Retrieve Tag" vc-retrieve-tag
+                 :help "Retrieve tagged version or branch"))
+    (define-key map [vc-create-tag]
+      '(menu-item "Create Tag" vc-create-tag
+                 :help "Create version tag"))
     (define-key map [separator1] '("----"))
     (define-key map [vc-annotate]
       '(menu-item "Annotate" vc-annotate
@@ -1071,23 +1072,6 @@ Used in `find-file-not-found-functions'."
 (defun vc-default-extra-menu (backend)
   nil)
 
-;; These are not correct and it's not currently clear how doing it
-;; better (with more complicated expressions) might slow things down
-;; on older systems.
-
-;;(put 'vc-rename-file 'menu-enable 'vc-mode)
-;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS))
-;;(put 'vc-revision-other-window 'menu-enable 'vc-mode)
-;;(put 'vc-diff 'menu-enable 'vc-mode)
-;;(put 'vc-update-change-log 'menu-enable
-;;     '(member (vc-buffer-backend) '(RCS CVS)))
-;;(put 'vc-print-log 'menu-enable 'vc-mode)
-;;(put 'vc-rollback 'menu-enable 'vc-mode)
-;;(put 'vc-revert 'menu-enable 'vc-mode)
-;;(put 'vc-insert-headers 'menu-enable 'vc-mode)
-;;(put 'vc-next-action 'menu-enable 'vc-mode)
-;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode)))
-
 (provide 'vc-hooks)
 
 ;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32