[Python-checkins] CVS: python/dist/src/Lib filecmp.py,1.5,1.6

Fred L. Drake python-dev@python.org
Mon, 3 Jul 2000 01:18:49 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8435

Modified Files:
	filecmp.py 
Log Message:

cmpfiles():  Added shallow and use_statcache parameters, with same meanings
             and defaults as for filecmp.cmp().  Updated docstring
             accordingly, and formatted it more like others in the standard
             library.


Index: filecmp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** filecmp.py	2000/06/29 14:13:28	1.5
--- filecmp.py	2000/07/03 08:18:47	1.6
***************
*** 17,21 ****
  BUFSIZE=8*1024
  
! def cmp(f1, f2, shallow=1,use_statcache=0):
      """Compare two files.
  
--- 17,21 ----
  BUFSIZE=8*1024
  
! def cmp(f1, f2, shallow=1, use_statcache=0):
      """Compare two files.
  
***************
*** 268,291 ****
  
  
! # Compare common files in two directories.
! # Return:
! #	- files that compare equal
! #	- files that compare different
! #	- funny cases (can't stat etc.)
! #
! def cmpfiles(a, b, common):
      """Compare common files in two directories.
  
!     cmpfiles(a,b,common)
!       A and B are directory names
!       COMMON is a list of file names
!     returns a tuple of three lists:
        files that compare equal
        files that are different
!       filenames that aren't regular files."""
  
      res = ([], [], [])
      for x in common:
!         res[_cmp(os.path.join(a, x), os.path.join(b, x))].append(x)
      return res
  
--- 268,290 ----
  
  
! def cmpfiles(a, b, common, shallow=1, use_statcache=0):
      """Compare common files in two directories.
+ 
+     a, b -- directory names
+     common -- list of file names found in both directories
+     shallow -- if true, do comparison based solely on stat() information
+     use_statcache -- if true, use statcache.stat() instead of os.stat()
  
!     Returns a tuple of three lists:
        files that compare equal
        files that are different
!       filenames that aren't regular files.
  
+     """
      res = ([], [], [])
      for x in common:
!         ax = os.path.join(a, x)
!         bx = os.path.join(b, x)
!         res[_cmp(ax, bx, shallow, use_statcache)].append(x)
      return res