Mercurial > emacs
comparison lisp/net/tramp.el @ 103635:11f316dfa4b5
* net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
also the 'rename case, when setting file modes. (Bug#3712)
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 30 Jun 2009 11:55:19 +0000 |
parents | 2cc306c7ad91 |
children | 6be9692e90bf |
comparison
equal
deleted
inserted
replaced
103634:c9a91925541c | 103635:11f316dfa4b5 |
---|---|
3223 the file (for rename). Both files must reside on the same host. | 3223 the file (for rename). Both files must reside on the same host. |
3224 KEEP-DATE means to make sure that NEWNAME has the same timestamp | 3224 KEEP-DATE means to make sure that NEWNAME has the same timestamp |
3225 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep | 3225 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep |
3226 the uid and gid from FILENAME." | 3226 the uid and gid from FILENAME." |
3227 (let ((t1 (tramp-tramp-file-p filename)) | 3227 (let ((t1 (tramp-tramp-file-p filename)) |
3228 (t2 (tramp-tramp-file-p newname))) | 3228 (t2 (tramp-tramp-file-p newname)) |
3229 (file-times (nth 5 (file-attributes filename))) | |
3230 (file-modes (tramp-default-file-modes filename))) | |
3229 (with-parsed-tramp-file-name (if t1 filename newname) nil | 3231 (with-parsed-tramp-file-name (if t1 filename newname) nil |
3230 (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p") | 3232 (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p") |
3231 ((eq op 'copy) "cp -f") | 3233 ((eq op 'copy) "cp -f") |
3232 ((eq op 'rename) "mv -f") | 3234 ((eq op 'rename) "mv -f") |
3233 (t (tramp-error | 3235 (t (tramp-error |
3362 (error))))))))) | 3364 (error))))))))) |
3363 | 3365 |
3364 ;; Set the time and mode. Mask possible errors. | 3366 ;; Set the time and mode. Mask possible errors. |
3365 (condition-case nil | 3367 (condition-case nil |
3366 (when keep-date | 3368 (when keep-date |
3367 (set-file-times newname (nth 5 (file-attributes filename))) | 3369 (set-file-times newname file-times) |
3368 (set-file-modes newname (tramp-default-file-modes filename))) | 3370 (set-file-modes newname file-modes)) |
3369 (error))))) | 3371 (error))))) |
3370 | 3372 |
3371 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) | 3373 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) |
3372 "Invoke rcp program to copy. | 3374 "Invoke rcp program to copy. |
3373 One of FILENAME and NEWNAME must be a Tramp name, the other must | 3375 One of FILENAME and NEWNAME must be a Tramp name, the other must |