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

Created on 2011-09-07 16:01 by kesmit, last changed 2018-01-03 09:42 by mitar.

Files
File name Uploaded Description Edit
issue12932.diff planet36, 2013-06-14 21:24 Add input parameter 'shallow' to dircmp. review
Messages (9)
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).
msg191154 - (view) Author: Steve Ward (planet36) Date: 2013-06-14 21:24
Add input parameter 'shallow' to dircmp.
Use it in phase3 and phase4.
Document it in filecmp.rst.

Did not modify test_filecmp.py.
msg247695 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-07-30 20:50
Thanks for the patch @planet36, however I think this is sufficiently large a change that we should also have a test case for it.

I'm also retargeting this to the current open branches for feature work - 3.6.
msg247696 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-07-30 20:51
Bah, wrong stage. patch review.
History
Date User Action Args
2018-01-03 09:42:28mitarsetnosy: + mitar
2015-07-30 20:51:20rbcollinssetmessages: + msg247696
stage: test needed -> patch review
2015-07-30 20:50:14rbcollinssetversions: + Python 3.6, - Python 3.4
nosy: + rbcollins

messages: + msg247695

stage: commit review -> test needed
2015-04-09 21:04:55r.david.murraysetstage: needs patch -> commit review
2013-06-14 21:24:17planet36setfiles: + issue12932.diff
keywords: + patch
messages: + msg191154
2013-06-06 19:52:11planet36setnosy: + planet36
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: resolved -> 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: resolved
2011-09-07 16:01:35kesmitcreate