]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp-cache.el (top): Autoload `tramp-time-less-p'.
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 27 Aug 2009 13:50:59 +0000 (13:50 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 27 Aug 2009 13:50:59 +0000 (13:50 +0000)
(tramp-cache-inhibit-cache): Extend doc string.  It allows also
timestamps.
(tramp-get-file-property): Check for timestamps in
`tramp-cache-inhibit-cache'.
(tramp-set-file-property): Write timestamp.

lisp/ChangeLog
lisp/net/tramp-cache.el

index 1072caf596be95ab5f8b4adcc8882feada1a4445..32ca7ac6f46ad558027a8cdce284b9f59bca55aa 100644 (file)
@@ -1,3 +1,39 @@
+2009-08-19  Julian Scheid  <julians37@gmail.com>  (tiny change)
+
+       * net/tramp.el (tramp-handle-process-file): Do not flush all
+       caches when `process-file-side-effects' is set.
+       (tramp-handle-vc-registered): Use `tramp-get-file-exists-command'
+       instead of `tramp-find-file-exists-command'.  Unset
+       `process-file-side-effects'.
+
+2009-08-27  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-methods): New method "rsyncc".
+       (top): Add completion function for "rsyncc".
+       (tramp-message-show-message): New defvar.
+       (tramp-message, tramp-error): Use it.
+       (tramp-do-copy-or-rename-file-directly): Extend check for direct
+       remote copying.
+       (tramp-do-copy-or-rename-file-out-of-band): Handle new
+       `tramp-methods' entry `copy-env' of "rsyncc".
+       (tramp-vc-registered-read-file-names): New defconst.
+       (tramp-vc-registered-file-names): New defvar.
+       (tramp-handle-vc-registered): Implement optimization strategy.
+       (tramp-run-real-handler): Add `tramp-vc-file-name-handler'.
+       (tramp-vc-file-name-handler): New defun.
+       (tramp-get-ls-command, tramp-get-test-command)
+       (tramp-get-file-exists-command, tramp-get-remote-ln)
+       (tramp-get-remote-perl, tramp-get-remote-stat)
+       (tramp-get-remote-id): Remove
+       superfluous `with-current-buffer'.
+
+       * net/tramp-cache.el (top): Autoload `tramp-time-less-p'.
+       (tramp-cache-inhibit-cache): Extend doc string.  It allows also
+       timestamps.
+       (tramp-get-file-property): Check for timestamps in
+       `tramp-cache-inhibit-cache'.
+       (tramp-set-file-property): Write timestamp.
+
 2009-08-27  ARISAWA Akihiro  <ari@mbf.ocn.ne.jp>  (tiny change)
 
        * language/japan-util.el (japanese-symbol-table): Add entries for
index 49bbd79cb4522ea24599680fe1bc6ea8a16c8764..3b1f4d46aaddb4eca64fb301c0941a1ed5331fda 100644 (file)
@@ -62,6 +62,7 @@
   (autoload 'tramp-file-name-host "tramp")
   (autoload 'tramp-file-name-localname "tramp")
   (autoload 'tramp-run-real-handler "tramp")
+  (autoload 'tramp-time-less-p "tramp")
   (autoload 'time-stamp-string "time-stamp"))
 
 ;;; -- Cache --
   "Hash table for remote files properties.")
 
 (defvar tramp-cache-inhibit-cache nil
-  "Inhibit cache read access, when non-nil.")
+  "Inhibit cache read access, when `t'.
+`nil' means to accept cache entries unconditionally.  If the
+value is a timestamp (as returned by `current-time'), cache
+entries are not used when they have been written before this
+time.")
 
 (defcustom tramp-persistency-file-name
   (cond
@@ -106,9 +111,21 @@ Returns DEFAULT if not set."
   (let* ((hash (or (gethash vec tramp-cache-data)
                   (puthash vec (make-hash-table :test 'equal)
                            tramp-cache-data)))
-        (value (if (and (null tramp-cache-inhibit-cache) (hash-table-p hash))
-                   (gethash property hash default)
-                 default)))
+        (value (when (hash-table-p hash) (gethash property hash))))
+    (if
+       ;; We take the value only if there is any, and
+       ;; `tramp-cache-inhibit-cache' indicates that it is still
+       ;; valid.  Otherwise, DEFAULT is set.
+       (and (consp value)
+            (or (null tramp-cache-inhibit-cache)
+                (and (consp tramp-cache-inhibit-cache)
+                     (tramp-time-less-p
+                      tramp-cache-inhibit-cache (car value)))))
+       (setq value (cdr value))
+      (setq value default))
+
+    (if (consp tramp-cache-inhibit-cache)
+       (tramp-message vec 1 "%s %s %s" file property value))
     (tramp-message vec 8 "%s %s %s" file property value)
     value))
 
@@ -121,7 +138,8 @@ Returns VALUE."
   (let ((hash (or (gethash vec tramp-cache-data)
                  (puthash vec (make-hash-table :test 'equal)
                           tramp-cache-data))))
-    (puthash property value hash)
+    ;; We put the timestamp there.
+    (puthash property (cons (current-time) value) hash)
     (tramp-message vec 8 "%s %s %s" file property value)
     value))