Mercurial > emacs
comparison lisp/net/tramp-vc.el @ 49598:0d8b17d428b5
Trailing whitepace deleted.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 04 Feb 2003 13:24:35 +0000 |
parents | 09acf3f65bb5 |
children | a0e8a85259ed d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
49597:e88404e8f2cf | 49598:0d8b17d428b5 |
---|---|
41 ;; -- vc -- | 41 ;; -- vc -- |
42 | 42 |
43 ;; This used to blow away the file-name-handler-alist and reinstall | 43 ;; 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, | 44 ;; TRAMP into it. This was intended to let VC work remotely. It didn't, |
45 ;; at least not in my XEmacs 21.2 install. | 45 ;; at least not in my XEmacs 21.2 install. |
46 ;; | 46 ;; |
47 ;; In any case, tramp-run-real-handler now deals correctly with disabling | 47 ;; In any case, tramp-run-real-handler now deals correctly with disabling |
48 ;; the things that should be, making this a no-op. | 48 ;; the things that should be, making this a no-op. |
49 ;; | 49 ;; |
50 ;; I have removed it from the tramp-file-name-handler-alist because the | 50 ;; I have removed it from the tramp-file-name-handler-alist because the |
51 ;; shortened version does nothing. This is for reference only now. | 51 ;; shortened version does nothing. This is for reference only now. |
86 (set-buffer (get-buffer-create buffer)) | 86 (set-buffer (get-buffer-create buffer)) |
87 (set (make-local-variable 'vc-parent-buffer) camefrom) | 87 (set (make-local-variable 'vc-parent-buffer) camefrom) |
88 (set (make-local-variable 'vc-parent-buffer-name) | 88 (set (make-local-variable 'vc-parent-buffer-name) |
89 (concat " from " (buffer-name camefrom))) | 89 (concat " from " (buffer-name camefrom))) |
90 (setq default-directory olddir) | 90 (setq default-directory olddir) |
91 | 91 |
92 (erase-buffer) | 92 (erase-buffer) |
93 | 93 |
94 (mapcar | 94 (mapcar |
95 (function | 95 (function |
96 (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) | 96 (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) |
214 "Invoke tramp-vc-do-command for tramp files." | 214 "Invoke tramp-vc-do-command for tramp files." |
215 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 215 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
216 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 216 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
217 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 217 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
218 (setq ad-return-value | 218 (setq ad-return-value |
219 (apply 'tramp-vc-do-command-new buffer okstatus command | 219 (apply 'tramp-vc-do-command-new buffer okstatus command |
220 file ;(or file (buffer-file-name)) | 220 file ;(or file (buffer-file-name)) |
221 flags)) | 221 flags)) |
222 ad-do-it))) | 222 ad-do-it))) |
223 (defadvice vc-do-command | 223 (defadvice vc-do-command |
224 (around tramp-advice-vc-do-command | 224 (around tramp-advice-vc-do-command |
227 "Invoke tramp-vc-do-command for tramp files." | 227 "Invoke tramp-vc-do-command for tramp files." |
228 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 228 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
229 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 229 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
230 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 230 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
231 (setq ad-return-value | 231 (setq ad-return-value |
232 (apply 'tramp-vc-do-command buffer okstatus command | 232 (apply 'tramp-vc-do-command buffer okstatus command |
233 (or file (buffer-file-name)) last flags)) | 233 (or file (buffer-file-name)) last flags)) |
234 ad-do-it)))) | 234 ad-do-it)))) |
235 ;;-) | 235 ;;-) |
236 | 236 |
237 | 237 |
281 ;; Get status from command | 281 ;; Get status from command |
282 (tramp-send-command multi-method method user host "echo $?") | 282 (tramp-send-command multi-method method user host "echo $?") |
283 (tramp-wait-for-output) | 283 (tramp-wait-for-output) |
284 (setq exec-status (read (current-buffer))) | 284 (setq exec-status (read (current-buffer))) |
285 (message "Command %s returned status %d." command exec-status))) | 285 (message "Command %s returned status %d." command exec-status))) |
286 | 286 |
287 ;; Maybe okstatus can be `async' here. But then, maybe the | 287 ;; Maybe okstatus can be `async' here. But then, maybe the |
288 ;; async thing is new in Emacs 21, but this function is only | 288 ;; async thing is new in Emacs 21, but this function is only |
289 ;; used in Emacs 20. | 289 ;; used in Emacs 20. |
290 (cond ((> exec-status okstatus) | 290 (cond ((> exec-status okstatus) |
291 (switch-to-buffer (get-file-buffer file)) | 291 (switch-to-buffer (get-file-buffer file)) |
302 "Invoke tramp-vc-simple-command for tramp files." | 302 "Invoke tramp-vc-simple-command for tramp files." |
303 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 303 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
304 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 304 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
305 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 305 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
306 (setq ad-return-value | 306 (setq ad-return-value |
307 (apply 'tramp-vc-simple-command okstatus command | 307 (apply 'tramp-vc-simple-command okstatus command |
308 (or file (buffer-file-name)) args)) | 308 (or file (buffer-file-name)) args)) |
309 ad-do-it))) | 309 ad-do-it))) |
310 | 310 |
311 | 311 |
312 ;; `vc-workfile-unchanged-p' | 312 ;; `vc-workfile-unchanged-p' |
360 (vc-resynch-buffer filename t t)) | 360 (vc-resynch-buffer filename t t)) |
361 ) | 361 ) |
362 | 362 |
363 | 363 |
364 ;; Do we need to advise the vc-user-login-name function anyway? | 364 ;; Do we need to advise the vc-user-login-name function anyway? |
365 ;; This will return the correct login name for the owner of a | 365 ;; This will return the correct login name for the owner of a |
366 ;; file. It does not deal with the default remote user name... | 366 ;; file. It does not deal with the default remote user name... |
367 ;; | 367 ;; |
368 ;; That is, when vc calls (vc-user-login-name), we return the | 368 ;; That is, when vc calls (vc-user-login-name), we return the |
369 ;; local login name, something that may be different to the remote | 369 ;; local login name, something that may be different to the remote |
370 ;; default. | 370 ;; default. |
371 ;; | 371 ;; |
372 ;; The remote VC operations will occur as the user that we logged | 372 ;; The remote VC operations will occur as the user that we logged |
373 ;; in with however - not always the same as the local user. | 373 ;; in with however - not always the same as the local user. |
374 ;; | 374 ;; |
375 ;; In the end, I did advise the function. This is because, well, | 375 ;; In the end, I did advise the function. This is because, well, |
376 ;; the thing didn't work right otherwise ;) | 376 ;; the thing didn't work right otherwise ;) |
377 ;; | 377 ;; |
378 ;; Daniel Pittman <daniel@danann.net> | 378 ;; Daniel Pittman <daniel@danann.net> |
379 | 379 |
380 (defun tramp-handle-vc-user-login-name (&optional uid) | 380 (defun tramp-handle-vc-user-login-name (&optional uid) |
415 (setq ad-return-value | 415 (setq ad-return-value |
416 (save-match-data | 416 (save-match-data |
417 (tramp-handle-vc-user-login-name uid)))) ; get the owner name | 417 (tramp-handle-vc-user-login-name uid)))) ; get the owner name |
418 ad-do-it))) ; else call the original | 418 ad-do-it))) ; else call the original |
419 | 419 |
420 | 420 |
421 ;; Determine the name of the user owning a file. | 421 ;; Determine the name of the user owning a file. |
422 (defun tramp-file-owner (filename) | 422 (defun tramp-file-owner (filename) |
423 "Return who owns FILE (user name, as a string)." | 423 "Return who owns FILE (user name, as a string)." |
424 (let ((v (tramp-dissect-file-name | 424 (let ((v (tramp-dissect-file-name |
425 (tramp-handle-expand-file-name filename)))) | 425 (tramp-handle-expand-file-name filename)))) |
426 (if (not (tramp-handle-file-exists-p filename)) | 426 (if (not (tramp-handle-file-exists-p filename)) |
427 nil ; file cannot be opened | 427 nil ; file cannot be opened |
428 ;; file exists, find out stuff | 428 ;; file exists, find out stuff |
429 (save-excursion | 429 (save-excursion |