/[emacs]/emacs/lisp/net/tramp-vc.el
ViewVC logotype

Diff of /emacs/lisp/net/tramp-vc.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by lektu, Tue Feb 4 13:17:16 2003 UTC revision 1.4 by kai, Fri Feb 28 18:28:47 2003 UTC
# Line 43  Line 43 
43  ;; This used to blow away the file-name-handler-alist and reinstall  ;; 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,  ;; TRAMP into it. This was intended to let VC work remotely. It didn't,
45  ;; at least not in my XEmacs 21.2 install.  ;; at least not in my XEmacs 21.2 install.
46  ;;  ;;
47  ;; In any case, tramp-run-real-handler now deals correctly with disabling  ;; In any case, tramp-run-real-handler now deals correctly with disabling
48  ;; the things that should be, making this a no-op.  ;; the things that should be, making this a no-op.
49  ;;  ;;
# Line 82  See `vc-do-command' for more information Line 82  See `vc-do-command' for more information
82               (method (tramp-file-name-method v))               (method (tramp-file-name-method v))
83               (user (tramp-file-name-user v))               (user (tramp-file-name-user v))
84               (host (tramp-file-name-host v))               (host (tramp-file-name-host v))
85               (path (tramp-file-name-path v)))               (localname (tramp-file-name-localname v)))
86          (set-buffer (get-buffer-create buffer))          (set-buffer (get-buffer-create buffer))
87          (set (make-local-variable 'vc-parent-buffer) camefrom)          (set (make-local-variable 'vc-parent-buffer) camefrom)
88          (set (make-local-variable 'vc-parent-buffer-name)          (set (make-local-variable 'vc-parent-buffer-name)
89               (concat " from " (buffer-name camefrom)))               (concat " from " (buffer-name camefrom)))
90          (setq default-directory olddir)          (setq default-directory olddir)
91        
92          (erase-buffer)          (erase-buffer)
93    
94          (mapcar          (mapcar
# Line 99  See `vc-do-command' for more information Line 99  See `vc-do-command' for more information
99                   (setq vc-file (vc-name file)))                   (setq vc-file (vc-name file)))
100              (setq squeezed              (setq squeezed
101                    (append squeezed                    (append squeezed
102                            (list (tramp-file-name-path                            (list (tramp-file-name-localname
103                                   (tramp-dissect-file-name vc-file))))))                                   (tramp-dissect-file-name vc-file))))))
104          (if (and file (eq last 'WORKFILE))          (if (and file (eq last 'WORKFILE))
105              (progn              (progn
# Line 172  Since TRAMP doesn't do async commands ye Line 172  Since TRAMP doesn't do async commands ye
172               (method (when file (tramp-file-name-method v)))               (method (when file (tramp-file-name-method v)))
173               (user (when file (tramp-file-name-user v)))               (user (when file (tramp-file-name-user v)))
174               (host (when file (tramp-file-name-host v)))               (host (when file (tramp-file-name-host v)))
175               (path (when file (tramp-file-name-path v))))               (localname (when file (tramp-file-name-localname v))))
176        (setq squeezed (delq nil (copy-sequence flags)))        (setq squeezed (delq nil (copy-sequence flags)))
177        (when file        (when file
178          (setq squeezed (append squeezed (list (file-relative-name          (setq squeezed (append squeezed (list (file-relative-name
# Line 194  Since TRAMP doesn't do async commands ye Line 194  Since TRAMP doesn't do async commands ye
194            (message "Running %s...OK" command))            (message "Running %s...OK" command))
195        (vc-exec-after        (vc-exec-after
196         `(run-hook-with-args         `(run-hook-with-args
197           'vc-post-command-functions ',command ',path ',flags))           'vc-post-command-functions ',command ',localname ',flags))
198        status))))        status))))
199    
200    
# Line 216  Since TRAMP doesn't do async commands ye Line 216  Since TRAMP doesn't do async commands ye
216          (if (or (and (stringp file)     (tramp-tramp-file-p file))          (if (or (and (stringp file)     (tramp-tramp-file-p file))
217                  (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))                  (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
218              (setq ad-return-value              (setq ad-return-value
219                    (apply 'tramp-vc-do-command-new buffer okstatus command                    (apply 'tramp-vc-do-command-new buffer okstatus command
220                           file ;(or file (buffer-file-name))                           file ;(or file (buffer-file-name))
221                           flags))                           flags))
222            ad-do-it)))            ad-do-it)))
# Line 229  Since TRAMP doesn't do async commands ye Line 229  Since TRAMP doesn't do async commands ye
229        (if (or (and (stringp file)     (tramp-tramp-file-p file))        (if (or (and (stringp file)     (tramp-tramp-file-p file))
230                (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))                (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
231            (setq ad-return-value            (setq ad-return-value
232                  (apply 'tramp-vc-do-command buffer okstatus command                  (apply 'tramp-vc-do-command buffer okstatus command
233                         (or file (buffer-file-name)) last flags))                         (or file (buffer-file-name)) last flags))
234          ad-do-it))))          ad-do-it))))
235  ;;-)  ;;-)
# Line 251  Since TRAMP doesn't do async commands ye Line 251  Since TRAMP doesn't do async commands ye
251             (method (tramp-file-name-method v))             (method (tramp-file-name-method v))
252             (user (tramp-file-name-user v))             (user (tramp-file-name-user v))
253             (host (tramp-file-name-host v))             (host (tramp-file-name-host v))
254             (path (tramp-file-name-path v)))             (localname (tramp-file-name-localname v)))
255        (save-excursion (set-buffer (get-buffer-create "*vc-info*"))        (save-excursion (set-buffer (get-buffer-create "*vc-info*"))
256                        (erase-buffer))                        (erase-buffer))
257        (let ((exec-path (append vc-path exec-path)) exec-status        (let ((exec-path (append vc-path exec-path)) exec-status
# Line 275  Since TRAMP doesn't do async commands ye Line 275  Since TRAMP doesn't do async commands ye
275              ;; Actually execute remote command              ;; Actually execute remote command
276              (tramp-handle-shell-command              (tramp-handle-shell-command
277               (mapconcat 'tramp-shell-quote-argument               (mapconcat 'tramp-shell-quote-argument
278                          (append (list command) args (list path)) " ")                          (append (list command) args (list localname)) " ")
279               (get-buffer-create"*vc-info*"))               (get-buffer-create"*vc-info*"))
280                                          ;(tramp-wait-for-output)                                          ;(tramp-wait-for-output)
281              ;; Get status from command              ;; Get status from command
# Line 283  Since TRAMP doesn't do async commands ye Line 283  Since TRAMP doesn't do async commands ye
283              (tramp-wait-for-output)              (tramp-wait-for-output)
284              (setq exec-status (read (current-buffer)))              (setq exec-status (read (current-buffer)))
285              (message "Command %s returned status %d." command exec-status)))              (message "Command %s returned status %d." command exec-status)))
286          
287          ;; Maybe okstatus can be `async' here.  But then, maybe the          ;; Maybe okstatus can be `async' here.  But then, maybe the
288          ;; async thing is new in Emacs 21, but this function is only          ;; async thing is new in Emacs 21, but this function is only
289          ;; used in Emacs 20.          ;; used in Emacs 20.
# Line 304  Since TRAMP doesn't do async commands ye Line 304  Since TRAMP doesn't do async commands ye
304      (if (or (and (stringp file)     (tramp-tramp-file-p file))      (if (or (and (stringp file)     (tramp-tramp-file-p file))
305              (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))              (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
306          (setq ad-return-value          (setq ad-return-value
307                (apply 'tramp-vc-simple-command okstatus command                (apply 'tramp-vc-simple-command okstatus command
308                       (or file (buffer-file-name)) args))                       (or file (buffer-file-name)) args))
309        ad-do-it)))        ad-do-it)))
310    
# Line 362  Since TRAMP doesn't do async commands ye Line 362  Since TRAMP doesn't do async commands ye
362    
363    
364  ;; Do we need to advise the vc-user-login-name function anyway?  ;; 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  ;; This will return the correct login name for the owner of a
366  ;; file. It does not deal with the default remote user name...  ;; file. It does not deal with the default remote user name...
367  ;;  ;;
368  ;; That is, when vc calls (vc-user-login-name), we return the  ;; That is, when vc calls (vc-user-login-name), we return the
369  ;; local login name, something that may be different to the remote  ;; local login name, something that may be different to the remote
370  ;; default.  ;; default.
371  ;;  ;;
372  ;; The remote VC operations will occur as the user that we logged  ;; The remote VC operations will occur as the user that we logged
373  ;; in with however - not always the same as the local user.  ;; in with however - not always the same as the local user.
374  ;;  ;;
375  ;; In the end, I did advise the function. This is because, well,  ;; In the end, I did advise the function. This is because, well,
376  ;; the thing didn't work right otherwise ;)  ;; the thing didn't work right otherwise ;)
377  ;;  ;;
378  ;; Daniel Pittman <daniel@danann.net>  ;; Daniel Pittman <daniel@danann.net>
# Line 417  filename we are thinking about..." Line 417  filename we are thinking about..."
417                       (tramp-handle-vc-user-login-name uid)))) ; get the owner name                       (tramp-handle-vc-user-login-name uid)))) ; get the owner name
418          ad-do-it)))                     ; else call the original          ad-do-it)))                     ; else call the original
419    
420      
421  ;; Determine the name of the user owning a file.  ;; Determine the name of the user owning a file.
422  (defun tramp-file-owner (filename)  (defun tramp-file-owner (filename)
423    "Return who owns FILE (user name, as a string)."    "Return who owns FILE (user name, as a string)."
424    (let ((v (tramp-dissect-file-name    (let ((v (tramp-dissect-file-name
425              (tramp-handle-expand-file-name filename))))              (tramp-handle-expand-file-name filename))))
426      (if (not (tramp-handle-file-exists-p filename))      (if (not (tramp-handle-file-exists-p filename))
427          nil                             ; file cannot be opened          nil                             ; file cannot be opened
# Line 435  filename we are thinking about..." Line 435  filename we are thinking about..."
435                                       (tramp-file-name-method v)                                       (tramp-file-name-method v)
436                                       (tramp-file-name-user v)                                       (tramp-file-name-user v)
437                                       (tramp-file-name-host v))                                       (tramp-file-name-host v))
438                   (tramp-shell-quote-argument (tramp-file-name-path v))))                   (tramp-shell-quote-argument (tramp-file-name-localname v))))
439          (tramp-wait-for-output)          (tramp-wait-for-output)
440          ;; parse `ls -l' output ...          ;; parse `ls -l' output ...
441          ;; ... file mode flags          ;; ... file mode flags

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26