comparison lisp/net/tramp-vc.el @ 55420:c44f9de543e3

2004-05-07 Kai Grossjohann <kai@emptydomain.de> Version 2.0.40 of Tramp released. * net/tramp.el (tramp-completion-mode, tramp-md5-function): Use symbol-function to invoke functions only known on some Emacs flavors. This avoids byte-compiler warnings. Reported by Kevin Scaldeferri <kevin@scaldeferri.com>. (tramp-do-copy-or-rename-file-via-buffer): Renamed from tramp-do-copy-or-rename-via-buffer (without `file'), to make it consistent with the other tramp-do-* functions. (tramp-do-copy-or-rename-file): Calls adjusted. (tramp-process-initial-commands): Avoid liveness check on shell -- we know that it must be alive since we're opening a connection at this moment. (tramp-last-cmd): New internal variable. (tramp-process-echoes): New tunable. (tramp-send-command): Set tramp-last-cmd. (tramp-wait-for-output): Delete echo, if applicable. (tramp-read-passwd): Construct the key for the password cache in a way that works for multi methods, too. (tramp-bug): Add backup-directory-alist and bkup-backup-directory-info to bug reports, with Tramp counterparts. 2004-05-01 Michael Albinus <michael.albinus@gmx.de> * net/tramp*.el: Suppress byte-compiler warnings where possible. * net/tramp.el (tramp-out-of-band-prompt-regexp) (tramp-actions-copy-out-of-band): New defcustoms. (tramp-do-copy-or-rename-file-out-of-band): Asynchronous process used instead of a synchronous one. Allows password entering. (tramp-action-out-of-band): New defun. (tramp-open-connection-rsh, tramp-method-out-of-band-p): Remove restriction with password from doc string. (tramp-bug): Add variables `tramp-terminal-prompt-regexp', `tramp-out-of-band-prompt-regexp', `tramp-actions-copy-out-of-band', `password-cache' and `password-cache-expiry'. (toplevel): Remove todo item wrt ssh-agent. Obsolete due to password caching. (tramp-touch): FILE can be a local file, too. (TODO): Remove items done. (tramp-handle-insert-directory): Properly quote file name also if not full-directory-p. Handle wildcard case. Reported by Andreas Schwab <schwab@suse.de>. (tramp-do-copy-or-rename-file-via-buffer): Set permissions of the new file. (tramp-handle-file-local-copy, tramp-handle-write-region): The permissions of the temporary file are set if filename exists. Reported by Ted Stern <stern@cray.com>. (tramp-backup-directory-alist) (tramp-bkup-backup-directory-info): New defcustoms. (tramp-file-name-handler-alist): Add entry for `find-backup-file-name'. (tramp-handle-find-backup-file-name): New function. Implements Tramp's find-backup-file-name. * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for `find-backup-file-name'. * net/tramp-vc.el (tramp-vc-workfile-unchanged-p): Correct typo ("file" -> "filename"). Reported by Kim F. Storm <storm@cua.dk>.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Fri, 07 May 2004 21:20:10 +0000
parents 0c19f1a19b2b
children 9459300bf43b 4c90ffeb71c5
comparison
equal deleted inserted replaced
55419:738233cdd3b0 55420:c44f9de543e3
1 ;;; tramp-vc.el --- Version control integration for TRAMP.el 1 ;;; tramp-vc.el --- Version control integration for TRAMP.el
2 2
3 ;; Copyright (C) 2000 by Free Software Foundation, Inc. 3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004 by Free Software Foundation, Inc.
4 4
5 ;; Author: Daniel Pittman <daniel@danann.net> 5 ;; Author: Daniel Pittman <daniel@danann.net>
6 ;; Keywords: comm, processes 6 ;; Keywords: comm, processes
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
35 (require 'vc) 35 (require 'vc)
36 ;; Old VC defines vc-rcs-release in vc.el, new VC requires extra module. 36 ;; Old VC defines vc-rcs-release in vc.el, new VC requires extra module.
37 (unless (boundp 'vc-rcs-release) 37 (unless (boundp 'vc-rcs-release)
38 (require 'vc-rcs)) 38 (require 'vc-rcs))
39 (require 'tramp) 39 (require 'tramp)
40
41 ;; Avoid byte-compiler warnings if the byte-compiler supports this.
42 ;; Currently, XEmacs supports this.
43 (eval-when-compile
44 (when (fboundp 'byte-compiler-options)
45 (let (unused-vars) ; Pacify Emacs byte-compiler
46 (defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
47 (byte-compiler-options (warnings (- unused-vars))))))
40 48
41 ;; -- vc -- 49 ;; -- vc --
42 50
43 ;; This used to blow away the file-name-handler-alist and reinstall 51 ;; This used to blow away the file-name-handler-alist and reinstall
44 ;; TRAMP into it. This was intended to let VC work remotely. It didn't, 52 ;; TRAMP into it. This was intended to let VC work remotely. It didn't,
161 Since TRAMP doesn't do async commands yet, this function doesn't, either." 169 Since TRAMP doesn't do async commands yet, this function doesn't, either."
162 (and file (setq file (expand-file-name file))) 170 (and file (setq file (expand-file-name file)))
163 (if vc-command-messages 171 (if vc-command-messages
164 (message "Running %s on %s..." command file)) 172 (message "Running %s on %s..." command file))
165 (save-current-buffer 173 (save-current-buffer
166 (unless (eq buffer t) (vc-setup-buffer buffer)) 174 (unless (eq buffer t)
175 ; Pacify byte-compiler
176 (funcall (symbol-function 'vc-setup-buffer) buffer))
167 (let ((squeezed nil) 177 (let ((squeezed nil)
168 (inhibit-read-only t) 178 (inhibit-read-only t)
169 (status 0)) 179 (status 0))
170 (let* ((v (when file (tramp-dissect-file-name file))) 180 (let* ((v (when file (tramp-dissect-file-name file)))
171 (multi-method (when file (tramp-file-name-multi-method v))) 181 (multi-method (when file (tramp-file-name-multi-method v)))
190 (shrink-window-if-larger-than-buffer) 200 (shrink-window-if-larger-than-buffer)
191 (error "Running %s...FAILED (%s)" command 201 (error "Running %s...FAILED (%s)" command
192 (if (integerp status) (format "status %d" status) status)))) 202 (if (integerp status) (format "status %d" status) status))))
193 (if vc-command-messages 203 (if vc-command-messages
194 (message "Running %s...OK" command)) 204 (message "Running %s...OK" command))
195 (vc-exec-after 205 ; Pacify byte-compiler
196 `(run-hook-with-args 206 (funcall (symbol-function 'vc-exec-after)
197 'vc-post-command-functions ',command ',localname ',flags)) 207 `(run-hook-with-args
208 'vc-post-command-functions ',command ',localname ',flags))
198 status)))) 209 status))))
199 210
200 211
201 ;; The context for a VC command is the current buffer. 212 ;; The context for a VC command is the current buffer.
202 ;; That makes a test on the buffers file more reliable than a test on the 213 ;; That makes a test on the buffers file more reliable than a test on the
323 (let ((status (funcall (symbol-function 'vc-backend-diff) 334 (let ((status (funcall (symbol-function 'vc-backend-diff)
324 filename nil nil 335 filename nil nil
325 (not want-differences-if-changed)))) 336 (not want-differences-if-changed))))
326 (zerop status)) 337 (zerop status))
327 ;; New VC. Call `vc-default-workfile-unchanged-p'. 338 ;; New VC. Call `vc-default-workfile-unchanged-p'.
328 (vc-default-workfile-unchanged-p (vc-backend file) filename))) 339 (funcall (symbol-function 'vc-default-workfile-unchanged-p)
340 (vc-backend filename) filename)))
329 341
330 (defadvice vc-workfile-unchanged-p 342 (defadvice vc-workfile-unchanged-p
331 (around tramp-advice-vc-workfile-unchanged-p 343 (around tramp-advice-vc-workfile-unchanged-p
332 (filename &optional want-differences-if-changed) 344 (filename &optional want-differences-if-changed)
333 activate) 345 activate)
389 This should only be called when `file' is bound to the 401 This should only be called when `file' is bound to the
390 filename we are thinking about..." 402 filename we are thinking about..."
391 ;; Pacify byte-compiler; this symbol is bound in the calling 403 ;; Pacify byte-compiler; this symbol is bound in the calling
392 ;; function. CCC: Maybe it would be better to move the 404 ;; function. CCC: Maybe it would be better to move the
393 ;; boundness-checking into this function? 405 ;; boundness-checking into this function?
394 (let ((file (symbol-value 'file)) 406 (let* ((file (symbol-value 'file))
395 (remote-uid 407 (remote-uid
396 ;; With Emacs 21.4, `file-attributes' has got an optional parameter 408 ;; With Emacs 21.4, `file-attributes' has got an optional parameter
397 ;; ID-FORMAT. Handle this case backwards compatible. 409 ;; ID-FORMAT. Handle this case backwards compatible.
398 (if (and (functionp 'subr-arity) 410 (if (and (functionp 'subr-arity)
399 (= 2 (cdr (subr-arity (symbol-function 'file-attributes))))) 411 (= 2 (cdr (funcall (symbol-function 'subr-arity)
400 (nth 2 (file-attributes file 'integer)) 412 (symbol-function 'file-attributes)))))
401 (nth 2 (file-attributes file))))) 413 (nth 2 (file-attributes file 'integer))
414 (nth 2 (file-attributes file)))))
402 (if (and uid (/= uid remote-uid)) 415 (if (and uid (/= uid remote-uid))
403 (error "tramp-handle-vc-user-login-name cannot map a uid to a name") 416 (error "tramp-handle-vc-user-login-name cannot map a uid to a name")
404 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) 417 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
405 (u (tramp-file-name-user v))) 418 (u (tramp-file-name-user v)))
406 (cond ((stringp u) u) 419 (cond ((stringp u) u)