classification
Title: filecmp.dircmp does not allow non-shallow comparisons
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, eric.araujo, kesmit, lregebro, terry.reedy
Priority: normal Keywords:

Created on 2011-09-07 16:01 by kesmit, last changed 2012-07-23 19:55 by chris.jerdonek.

Messages (6)
msg143692 - (view) Author: Kevin Smith (kesmit) Date: 2011-09-07 16:01
While filecmp.cmp and filecmp.cmpfiles allow a shallow option to be specified to invoke a more involved comparison of files, filecmp.dircmp does not.  It is limited to shallow-only comparisons.  

This could be solved quite easily by adding a shallow keyword option to dircmp then changing the phase3 method to the following.

    def phase3(self): # Find out differences between common files
        xx = cmpfiles(self.left, self.right, self.common_files, self.shallow)
        self.same_files, self.diff_files, self.funny_files = xx
msg156736 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-25 06:59
Thanks for the report.  Unfortunately 2.7 is closed to new features and the module is removed in 3.x, so there is nothing to do here.
msg160966 - (view) Author: Lennart Regebro (lregebro) Date: 2012-05-17 12:05
filecmp is still there in Python 3.3 Alpha 3. I can't find any reference to it being deprecated.
msg161823 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-05-29 00:34
Lennart, I saw your response on StackOverflow ;-).
msg164648 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-04 14:41
+1 for this.

Whether or not this feature is implemented, I think the documentation should state that directory comparisons are done using "shallow=True".  I created issue 15250 for this.
msg166246 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-07-23 19:55
Allowing dircmp() to accept a file comparison function is another option to consider that may address more needs going forward.  shallow=False could be achieved by passing lambda a, b: filecmp.cmp(a, b, shallow=False).
History
Date User Action Args
2012-07-23 19:55:29chris.jerdoneksetmessages: + msg166246
versions: + Python 3.4, - Python 3.3
2012-07-04 14:41:23chris.jerdoneksetnosy: + chris.jerdonek
messages: + msg164648
2012-06-01 17:58:23eric.araujosettitle: dircmp does not allow non-shallow comparisons -> filecmp.dircmp does not allow non-shallow comparisons
stage: test needed -> needs patch
2012-05-29 00:34:35terry.reedysetstatus: closed -> open

versions: + Python 3.3, - Python 2.6, Python 2.7
nosy: + terry.reedy

messages: + msg161823
resolution: out of date ->
stage: committed/rejected -> test needed
2012-05-17 12:05:52lregebrosetnosy: + lregebro
messages: + msg160966
2012-03-25 06:59:24eric.araujosetstatus: open -> closed

nosy: + eric.araujo
messages: + msg156736

resolution: out of date
stage: committed/rejected
2011-09-07 16:01:35kesmitcreate