emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107457: * lisp/files.el (file-equal-


From: thierry volpiatto
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107457: * lisp/files.el (file-equal-p): renamed from `files-equal-p'.
Date: Tue, 28 Feb 2012 10:28:52 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107457
committer: thierry volpiatto <address@hidden
branch nick: trunk
timestamp: Tue 2012-02-28 10:28:52 +0100
message:
  * lisp/files.el (file-equal-p): renamed from `files-equal-p'.
  Now return nil when one or both files doesn't exists.
  (file-subdir-of-p): Now only top directory must exists,
  return nil if it doesn't.
  (copy-directory): No need to test with `file-subdir-of-p' after creating dir.
  * tramp.el (tramp-file-name-for-operation): Rename `files-equal-p' to 
`file-equal-p'.
  * files.texi: Rename `files-equal-p' to `file-equal-p'.
modified:
  doc/lispref/ChangeLog
  doc/lispref/files.texi
  lisp/ChangeLog
  lisp/files.el
  lisp/net/tramp.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2012-02-28 08:17:21 +0000
+++ b/doc/lispref/ChangeLog     2012-02-28 09:28:52 +0000
@@ -1,3 +1,8 @@
+2012-02-28  Thierry Volpiatto  <address@hidden>
+
+       * files.texi Rename files-equal-p to file-equal-p.
+       Update chnaged behavior of file-subdir-of-p.
+
 2012-02-28  Glenn Morris  <address@hidden>
 
        * advice.texi, anti.texi, display.texi, elisp.texi:

=== modified file 'doc/lispref/files.texi'
--- a/doc/lispref/files.texi    2012-02-27 07:26:13 +0000
+++ b/doc/lispref/files.texi    2012-02-28 09:28:52 +0000
@@ -1018,7 +1018,7 @@
 other I/O device).
 @end defun
 
address@hidden files-equal-p file1 file2
address@hidden file-equal-p file1 file2
 This function returns @code{t} if the files @var{file1} and
 @var{file2} name the same file.  Two ordinary files are considered to
 be the same if the function @code{file-attributes} (@pxref{File
@@ -1029,9 +1029,8 @@
 This function returns @code{t} if directory @var{dir1} is a
 subdirectory of @var{dir2}, or if @var{dir1} and @var{dir2} are the
 same directory.  It compares the @code{file-truename} values of the
-two directories (@pxref{Truenames}).  If either @var{dir1} or
address@hidden do not name existing directories, the return value is
address@hidden
+two directories (@pxref{Truenames}).  If @var{dir2} 
+do not name an existing directory, the return value is @code{nil}.
 @end defun
 
 @node Truenames
@@ -2722,7 +2721,7 @@
 @code{file-ownership-preserved-p},
 @code{file-readable-p}, @code{file-regular-p}, @code{file-subdir-of-p},
 @code{file-symlink-p}, @code{file-truename}, @code{file-writable-p},
address@hidden, @code{find-backup-file-name},
address@hidden, @code{find-backup-file-name},
 @c Not sure why it was here:   @code{find-file-noselect},@*
 @code{get-file-buffer},
 @code{insert-directory},

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-02-28 08:17:21 +0000
+++ b/lisp/ChangeLog    2012-02-28 09:28:52 +0000
@@ -1,3 +1,12 @@
+2012-02-28  Thierry Volpiatto  <address@hidden>
+
+       * lisp/files.el (file-equal-p): renamed from `files-equal-p'.
+       Now return nil when one or both files doesn't exists.
+       (file-subdir-of-p): Now only top directory must exists,
+       return nil if it doesn't.
+       (copy-directory): No need to test with `file-subdir-of-p' after 
creating dir.
+       * tramp.el (tramp-file-name-for-operation): Rename `files-equal-p' to 
`file-equal-p'.
+
 2012-02-28  Glenn Morris  <address@hidden>
 
        * shell.el (shell-mode):

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2012-02-28 08:17:21 +0000
+++ b/lisp/files.el     2012-02-28 09:28:52 +0000
@@ -4985,27 +4985,26 @@
                 directory 'full directory-files-no-dot-files-regexp)))
       (delete-directory-internal directory)))))
 
-(defun files-equal-p (file1 file2)
-  "Return non-nil if FILE1 and FILE2 name the same file.
-Ordinary files are considered to be the same if `file-attributes'
-returns `equal' values for them."
-  (let ((handler (or (find-file-name-handler file1 'files-equal-p)
-                     (find-file-name-handler file2 'files-equal-p))))
+(defun file-equal-p (file1 file2)
+  "Return non-nil if existing files FILE1 and FILE2 name the same file.
+Return nil if one or both files doesn't exists."
+  (let ((handler (or (find-file-name-handler file1 'file-equal-p)
+                     (find-file-name-handler file2 'file-equal-p))))
     (if handler
-        (funcall handler 'files-equal-p file1 file2)
-      (equal (file-attributes (file-truename file1))
-             (file-attributes (file-truename file2))))))
+        (funcall handler 'file-equal-p file1 file2)
+      (let ((f1-attr (file-attributes (file-truename file1)))
+            (f2-attr (file-attributes (file-truename file2))))
+        (and f1-attr f2-attr (equal f1-attr f2-attr))))))
 
 (defun file-subdir-of-p (dir1 dir2)
   "Return non-nil if DIR1 is a subdirectory of DIR2.
 A directory is considered to be a subdirectory of itself.
-Return nil if DIR1 or DIR2 are not existing directories."
+Return nil if top directory DIR2 is not an existing directory."
   (let ((handler (or (find-file-name-handler dir1 'file-subdir-of-p)
                      (find-file-name-handler dir2 'file-subdir-of-p))))
     (if handler
         (funcall handler 'file-subdir-of-p dir1 dir2)
-      (when (and (file-directory-p dir1)
-                 (file-directory-p dir2))
+      (when (file-directory-p dir2) ; Top dir must exist.
        (setq dir1 (file-truename dir1)
              dir2 (file-truename dir2))
        (let ((ls1  (or (split-string dir1 "/" t) '("/")))
@@ -5019,7 +5018,7 @@
            (setq ls1 (cdr ls1)
                  ls2 (cdr ls2)))
          (unless mismatch
-           (files-equal-p (file-truename root) dir2)))))))
+           (file-equal-p root dir2)))))))
 
 (defun copy-directory (directory newname &optional keep-time parents 
copy-contents)
   "Copy DIRECTORY to NEWNAME.  Both args must be strings.
@@ -5065,12 +5064,7 @@
       (cond ((not (file-directory-p newname))
             ;; If NEWNAME is not an existing directory, create it;
             ;; that is where we will copy the files of DIRECTORY.
-            (make-directory newname parents)
-             ;; `file-subdir-of-p' doesn't handle non--existing directories,
-             ;; so double check now if NEWNAME is not a subdir of DIRECTORY.
-             (and (file-subdir-of-p newname directory)
-                  (error "Cannot copy `%s' into its subdirectory `%s'"
-                         directory newname)))
+            (make-directory newname parents))
            ;; If NEWNAME is an existing directory and COPY-CONTENTS
            ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME].
            ((not copy-contents)

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2012-02-26 19:36:59 +0000
+++ b/lisp/net/tramp.el 2012-02-28 09:28:52 +0000
@@ -1810,7 +1810,7 @@
                  ;; Emacs 23+ only.
                  'copy-directory
                  ;; Emacs 24+ only.
-                 'files-equal-p 'file-subdir-of-p
+                 'file-equal-p 'file-subdir-of-p
                  ;; XEmacs only.
                  'dired-make-relative-symlink
                  'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]