Mercurial > emacs
comparison lisp/net/tramp-vc.el @ 59996:aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Change development version from 21.3.50 to 22.0.50.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 09 Feb 2005 15:50:47 +0000 |
parents | 92796330257a |
children | 3ba8f94e9cfa 3ebd9bdb4fe5 |
comparison
equal
deleted
inserted
replaced
59995:8f4938738427 | 59996:aac0a33f5772 |
---|---|
49 ;; -- vc -- | 49 ;; -- vc -- |
50 | 50 |
51 ;; 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 |
52 ;; 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, |
53 ;; at least not in my XEmacs 21.2 install. | 53 ;; at least not in my XEmacs 21.2 install. |
54 ;; | 54 ;; |
55 ;; In any case, tramp-run-real-handler now deals correctly with disabling | 55 ;; In any case, tramp-run-real-handler now deals correctly with disabling |
56 ;; the things that should be, making this a no-op. | 56 ;; the things that should be, making this a no-op. |
57 ;; | 57 ;; |
58 ;; I have removed it from the tramp-file-name-handler-alist because the | 58 ;; I have removed it from the tramp-file-name-handler-alist because the |
59 ;; shortened version does nothing. This is for reference only now. | 59 ;; shortened version does nothing. This is for reference only now. |
94 (set-buffer (get-buffer-create buffer)) | 94 (set-buffer (get-buffer-create buffer)) |
95 (set (make-local-variable 'vc-parent-buffer) camefrom) | 95 (set (make-local-variable 'vc-parent-buffer) camefrom) |
96 (set (make-local-variable 'vc-parent-buffer-name) | 96 (set (make-local-variable 'vc-parent-buffer-name) |
97 (concat " from " (buffer-name camefrom))) | 97 (concat " from " (buffer-name camefrom))) |
98 (setq default-directory olddir) | 98 (setq default-directory olddir) |
99 | 99 |
100 (erase-buffer) | 100 (erase-buffer) |
101 | 101 |
102 (mapcar | 102 (mapcar |
103 (function | 103 (function |
104 (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) | 104 (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) |
228 "Invoke tramp-vc-do-command for tramp files." | 228 "Invoke tramp-vc-do-command for tramp files." |
229 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 229 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
230 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 230 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
231 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 231 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
232 (setq ad-return-value | 232 (setq ad-return-value |
233 (apply 'tramp-vc-do-command-new buffer okstatus command | 233 (apply 'tramp-vc-do-command-new buffer okstatus command |
234 file ;(or file (buffer-file-name)) | 234 file ;(or file (buffer-file-name)) |
235 flags)) | 235 flags)) |
236 ad-do-it))) | 236 ad-do-it))) |
237 (defadvice vc-do-command | 237 (defadvice vc-do-command |
238 (around tramp-advice-vc-do-command | 238 (around tramp-advice-vc-do-command |
241 "Invoke tramp-vc-do-command for tramp files." | 241 "Invoke tramp-vc-do-command for tramp files." |
242 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 242 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
243 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 243 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
244 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 244 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
245 (setq ad-return-value | 245 (setq ad-return-value |
246 (apply 'tramp-vc-do-command buffer okstatus command | 246 (apply 'tramp-vc-do-command buffer okstatus command |
247 (or file (buffer-file-name)) last flags)) | 247 (or file (buffer-file-name)) last flags)) |
248 ad-do-it))))) | 248 ad-do-it))))) |
249 ;;-) | 249 ;;-) |
250 | 250 |
251 | 251 |
296 ;; Get status from command | 296 ;; Get status from command |
297 (tramp-send-command multi-method method user host "echo $?") | 297 (tramp-send-command multi-method method user host "echo $?") |
298 (tramp-wait-for-output) | 298 (tramp-wait-for-output) |
299 (setq exec-status (read (current-buffer))) | 299 (setq exec-status (read (current-buffer))) |
300 (message "Command %s returned status %d." command exec-status))) | 300 (message "Command %s returned status %d." command exec-status))) |
301 | 301 |
302 ;; Maybe okstatus can be `async' here. But then, maybe the | 302 ;; Maybe okstatus can be `async' here. But then, maybe the |
303 ;; async thing is new in Emacs 21, but this function is only | 303 ;; async thing is new in Emacs 21, but this function is only |
304 ;; used in Emacs 20. | 304 ;; used in Emacs 20. |
305 (cond ((> exec-status okstatus) | 305 (cond ((> exec-status okstatus) |
306 (switch-to-buffer (get-file-buffer file)) | 306 (switch-to-buffer (get-file-buffer file)) |
317 "Invoke tramp-vc-simple-command for tramp files." | 317 "Invoke tramp-vc-simple-command for tramp files." |
318 (let ((file (symbol-value 'file))) ;pacify byte-compiler | 318 (let ((file (symbol-value 'file))) ;pacify byte-compiler |
319 (if (or (and (stringp file) (tramp-tramp-file-p file)) | 319 (if (or (and (stringp file) (tramp-tramp-file-p file)) |
320 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 320 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
321 (setq ad-return-value | 321 (setq ad-return-value |
322 (apply 'tramp-vc-simple-command okstatus command | 322 (apply 'tramp-vc-simple-command okstatus command |
323 (or file (buffer-file-name)) args)) | 323 (or file (buffer-file-name)) args)) |
324 ad-do-it))) | 324 ad-do-it))) |
325 | 325 |
326 | 326 |
327 ;; `vc-workfile-unchanged-p' | 327 ;; `vc-workfile-unchanged-p' |
379 (vc-resynch-buffer filename t t)) | 379 (vc-resynch-buffer filename t t)) |
380 ) | 380 ) |
381 | 381 |
382 | 382 |
383 ;; Do we need to advise the vc-user-login-name function anyway? | 383 ;; Do we need to advise the vc-user-login-name function anyway? |
384 ;; This will return the correct login name for the owner of a | 384 ;; This will return the correct login name for the owner of a |
385 ;; file. It does not deal with the default remote user name... | 385 ;; file. It does not deal with the default remote user name... |
386 ;; | 386 ;; |
387 ;; That is, when vc calls (vc-user-login-name), we return the | 387 ;; That is, when vc calls (vc-user-login-name), we return the |
388 ;; local login name, something that may be different to the remote | 388 ;; local login name, something that may be different to the remote |
389 ;; default. | 389 ;; default. |
390 ;; | 390 ;; |
391 ;; The remote VC operations will occur as the user that we logged | 391 ;; The remote VC operations will occur as the user that we logged |
392 ;; in with however - not always the same as the local user. | 392 ;; in with however - not always the same as the local user. |
393 ;; | 393 ;; |
394 ;; In the end, I did advise the function. This is because, well, | 394 ;; In the end, I did advise the function. This is because, well, |
395 ;; the thing didn't work right otherwise ;) | 395 ;; the thing didn't work right otherwise ;) |
396 ;; | 396 ;; |
397 ;; Daniel Pittman <daniel@danann.net> | 397 ;; Daniel Pittman <daniel@danann.net> |
398 | 398 |
399 (defun tramp-handle-vc-user-login-name (&optional uid) | 399 (defun tramp-handle-vc-user-login-name (&optional uid) |
407 ;; Pacify byte-compiler; this symbol is bound in the calling | 407 ;; Pacify byte-compiler; this symbol is bound in the calling |
408 ;; function. CCC: Maybe it would be better to move the | 408 ;; function. CCC: Maybe it would be better to move the |
409 ;; boundness-checking into this function? | 409 ;; boundness-checking into this function? |
410 (let* ((file (symbol-value 'file)) | 410 (let* ((file (symbol-value 'file)) |
411 (remote-uid | 411 (remote-uid |
412 ;; With Emacs 21.4, `file-attributes' has got an optional parameter | 412 ;; With Emacs 22.1, `file-attributes' has got an optional parameter |
413 ;; ID-FORMAT. Handle this case backwards compatible. | 413 ;; ID-FORMAT. Handle this case backwards compatible. |
414 (if (and (functionp 'subr-arity) | 414 (if (and (functionp 'subr-arity) |
415 (= 2 (cdr (funcall (symbol-function 'subr-arity) | 415 (= 2 (cdr (funcall (symbol-function 'subr-arity) |
416 (symbol-function 'file-attributes))))) | 416 (symbol-function 'file-attributes))))) |
417 (nth 2 (file-attributes file 'integer)) | 417 (nth 2 (file-attributes file 'integer)) |
442 (setq ad-return-value | 442 (setq ad-return-value |
443 (save-match-data | 443 (save-match-data |
444 (tramp-handle-vc-user-login-name uid)))) ; get the owner name | 444 (tramp-handle-vc-user-login-name uid)))) ; get the owner name |
445 ad-do-it))) ; else call the original | 445 ad-do-it))) ; else call the original |
446 | 446 |
447 | 447 |
448 ;; Determine the name of the user owning a file. | 448 ;; Determine the name of the user owning a file. |
449 (defun tramp-file-owner (filename) | 449 (defun tramp-file-owner (filename) |
450 "Return who owns FILE (user name, as a string)." | 450 "Return who owns FILE (user name, as a string)." |
451 (let ((v (tramp-dissect-file-name | 451 (let ((v (tramp-dissect-file-name |
452 (expand-file-name filename)))) | 452 (expand-file-name filename)))) |
453 (if (not (file-exists-p filename)) | 453 (if (not (file-exists-p filename)) |
454 nil ; file cannot be opened | 454 nil ; file cannot be opened |
455 ;; file exists, find out stuff | 455 ;; file exists, find out stuff |
456 (save-excursion | 456 (save-excursion |