Mercurial > emacs
comparison lisp/net/tramp-vc.el @ 56460:9459300bf43b
Sync with Tramp 2.0.43.
(tramp-handle-verify-visited-file-modtime): Remove
outdated comment.
(tramp-locked, tramp-locker): New variables for implementing a
global lock.
(tramp-sh-file-name-handler): Use them to implement the global
lock.
author | Kai Großjohann <kgrossjo@eu.uu.net> |
---|---|
date | Sat, 17 Jul 2004 17:28:43 +0000 |
parents | c44f9de543e3 |
children | b324ca4df07c b9eee0a7bef5 |
comparison
equal
deleted
inserted
replaced
56459:718cf6b0289c | 56460:9459300bf43b |
---|---|
75 ;; CCC: this probably works for Emacs 21, too. | 75 ;; CCC: this probably works for Emacs 21, too. |
76 (defun tramp-vc-do-command (buffer okstatus command file last &rest flags) | 76 (defun tramp-vc-do-command (buffer okstatus command file last &rest flags) |
77 "Like `vc-do-command' but invoked for tramp files. | 77 "Like `vc-do-command' but invoked for tramp files. |
78 See `vc-do-command' for more information." | 78 See `vc-do-command' for more information." |
79 (save-match-data | 79 (save-match-data |
80 (and file (setq file (tramp-handle-expand-file-name file))) | 80 (and file (setq file (expand-file-name file))) |
81 (if (not buffer) (setq buffer "*vc*")) | 81 (if (not buffer) (setq buffer "*vc*")) |
82 (if vc-command-messages | 82 (if vc-command-messages |
83 (message "Running `%s' on `%s'..." command file)) | 83 (message "Running `%s' on `%s'..." command file)) |
84 (let ((obuf (current-buffer)) (camefrom (current-buffer)) | 84 (let ((obuf (current-buffer)) (camefrom (current-buffer)) |
85 (squeezed nil) | 85 (squeezed nil) |
86 (olddir default-directory) | 86 (olddir default-directory) |
87 vc-file status) | 87 vc-file status) |
88 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) | 88 (let* ((v (tramp-dissect-file-name (expand-file-name file))) |
89 (multi-method (tramp-file-name-multi-method v)) | 89 (multi-method (tramp-file-name-multi-method v)) |
90 (method (tramp-file-name-method v)) | 90 (method (tramp-file-name-method v)) |
91 (user (tramp-file-name-user v)) | 91 (user (tramp-file-name-user v)) |
92 (host (tramp-file-name-host v)) | 92 (host (tramp-file-name-host v)) |
93 (localname (tramp-file-name-localname v))) | 93 (localname (tramp-file-name-localname v))) |
128 ;; | 128 ;; |
129 ;; Daniel Pittman <daniel@danann.net> | 129 ;; Daniel Pittman <daniel@danann.net> |
130 (save-excursion | 130 (save-excursion |
131 (save-window-excursion | 131 (save-window-excursion |
132 ;; Actually execute remote command | 132 ;; Actually execute remote command |
133 (tramp-handle-shell-command | 133 (shell-command |
134 (mapconcat 'tramp-shell-quote-argument | 134 (mapconcat 'tramp-shell-quote-argument |
135 (cons command squeezed) " ") t) | 135 (cons command squeezed) " ") t) |
136 ;;(tramp-wait-for-output) | 136 ;;(tramp-wait-for-output) |
137 ;; Get status from command | 137 ;; Get status from command |
138 (tramp-send-command multi-method method user host "echo $?") | 138 (tramp-send-command multi-method method user host "echo $?") |
188 (setq squeezed (append squeezed (list (file-relative-name | 188 (setq squeezed (append squeezed (list (file-relative-name |
189 file default-directory))))) | 189 file default-directory))))) |
190 (let ((w32-quote-process-args t)) | 190 (let ((w32-quote-process-args t)) |
191 (when (eq okstatus 'async) | 191 (when (eq okstatus 'async) |
192 (message "Tramp doesn't do async commands, running synchronously.")) | 192 (message "Tramp doesn't do async commands, running synchronously.")) |
193 (setq status (tramp-handle-shell-command | 193 (setq status (shell-command |
194 (mapconcat 'tramp-shell-quote-argument | 194 (mapconcat 'tramp-shell-quote-argument |
195 (cons command squeezed) " ") t)) | 195 (cons command squeezed) " ") t)) |
196 (when (or (not (integerp status)) | 196 (when (or (not (integerp status)) |
197 (and (integerp okstatus) (< okstatus status))) | 197 (and (integerp okstatus) (< okstatus status))) |
198 (pop-to-buffer (current-buffer)) | 198 (pop-to-buffer (current-buffer)) |
255 (defun tramp-vc-simple-command (okstatus command file &rest args) | 255 (defun tramp-vc-simple-command (okstatus command file &rest args) |
256 ;; Simple version of vc-do-command, for use in vc-hooks only. | 256 ;; Simple version of vc-do-command, for use in vc-hooks only. |
257 ;; Don't switch to the *vc-info* buffer before running the | 257 ;; Don't switch to the *vc-info* buffer before running the |
258 ;; command, because that would change its default directory | 258 ;; command, because that would change its default directory |
259 (save-match-data | 259 (save-match-data |
260 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) | 260 (let* ((v (tramp-dissect-file-name (expand-file-name file))) |
261 (multi-method (tramp-file-name-multi-method v)) | 261 (multi-method (tramp-file-name-multi-method v)) |
262 (method (tramp-file-name-method v)) | 262 (method (tramp-file-name-method v)) |
263 (user (tramp-file-name-user v)) | 263 (user (tramp-file-name-user v)) |
264 (host (tramp-file-name-host v)) | 264 (host (tramp-file-name-host v)) |
265 (localname (tramp-file-name-localname v))) | 265 (localname (tramp-file-name-localname v))) |
282 ;; | 282 ;; |
283 ;; Daniel Pittman <daniel@danann.net> | 283 ;; Daniel Pittman <daniel@danann.net> |
284 (save-excursion | 284 (save-excursion |
285 (save-window-excursion | 285 (save-window-excursion |
286 ;; Actually execute remote command | 286 ;; Actually execute remote command |
287 (tramp-handle-shell-command | 287 (shell-command |
288 (mapconcat 'tramp-shell-quote-argument | 288 (mapconcat 'tramp-shell-quote-argument |
289 (append (list command) args (list localname)) " ") | 289 (append (list command) args (list localname)) " ") |
290 (get-buffer-create"*vc-info*")) | 290 (get-buffer-create"*vc-info*")) |
291 ;(tramp-wait-for-output) | 291 ;(tramp-wait-for-output) |
292 ;; Get status from command | 292 ;; Get status from command |
412 (symbol-function 'file-attributes))))) | 412 (symbol-function 'file-attributes))))) |
413 (nth 2 (file-attributes file 'integer)) | 413 (nth 2 (file-attributes file 'integer)) |
414 (nth 2 (file-attributes file))))) | 414 (nth 2 (file-attributes file))))) |
415 (if (and uid (/= uid remote-uid)) | 415 (if (and uid (/= uid remote-uid)) |
416 (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") |
417 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) | 417 (let* ((v (tramp-dissect-file-name (expand-file-name file))) |
418 (u (tramp-file-name-user v))) | 418 (u (tramp-file-name-user v))) |
419 (cond ((stringp u) u) | 419 (cond ((stringp u) u) |
420 ((vectorp u) (elt u (1- (length u)))) | 420 ((vectorp u) (elt u (1- (length u)))) |
421 ((null u) (user-login-name)) | 421 ((null u) (user-login-name)) |
422 (t (error "tramp-handle-vc-user-login-name cannot cope!"))))))) | 422 (t (error "tramp-handle-vc-user-login-name cannot cope!"))))))) |
443 | 443 |
444 ;; Determine the name of the user owning a file. | 444 ;; Determine the name of the user owning a file. |
445 (defun tramp-file-owner (filename) | 445 (defun tramp-file-owner (filename) |
446 "Return who owns FILE (user name, as a string)." | 446 "Return who owns FILE (user name, as a string)." |
447 (let ((v (tramp-dissect-file-name | 447 (let ((v (tramp-dissect-file-name |
448 (tramp-handle-expand-file-name filename)))) | 448 (expand-file-name filename)))) |
449 (if (not (tramp-handle-file-exists-p filename)) | 449 (if (not (file-exists-p filename)) |
450 nil ; file cannot be opened | 450 nil ; file cannot be opened |
451 ;; file exists, find out stuff | 451 ;; file exists, find out stuff |
452 (save-excursion | 452 (save-excursion |
453 (tramp-send-command | 453 (tramp-send-command |
454 (tramp-file-name-multi-method v) (tramp-file-name-method v) | 454 (tramp-file-name-multi-method v) (tramp-file-name-method v) |