summaryrefslogtreecommitdiffstats
path: root/Lib/filecmp.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-01-12 14:13:32 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-01-12 14:13:32 (GMT)
commiteb2884a87575f49d797d504872b2efd1f132a771 (patch)
treedc23e9de311ff042e88af1b6d5c03750e9e665df /Lib/filecmp.py
parent60a0c710311b29539f8c8a6404a51b21f44b1e43 (diff)
downloadcpython-eb2884a87575f49d797d504872b2efd1f132a771.zip
cpython-eb2884a87575f49d797d504872b2efd1f132a771.tar.gz
cpython-eb2884a87575f49d797d504872b2efd1f132a771.tar.bz2
Close #15442: Expand the list of default directories ignored by filecmp.dircmp and expose it as a module attribute
Diffstat (limited to 'Lib/filecmp.py')
-rw-r--r--Lib/filecmp.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/filecmp.py b/Lib/filecmp.py
index 5bbd0e8..014c0d0 100644
--- a/Lib/filecmp.py
+++ b/Lib/filecmp.py
@@ -13,11 +13,15 @@ import os
import stat
from itertools import filterfalse
-__all__ = ["cmp", "dircmp", "cmpfiles"]
+__all__ = ['cmp', 'dircmp', 'cmpfiles', 'DEFAULT_IGNORES']
_cache = {}
BUFSIZE = 8*1024
+DEFAULT_IGNORES = [
+ 'RCS', 'CVS', 'tags', '.git', '.hg', '.bzr', '_darcs', '__pycache__']
+
+
def cmp(f1, f2, shallow=True):
"""Compare two files.
@@ -80,7 +84,7 @@ class dircmp:
dircmp(a, b, ignore=None, hide=None)
A and B are directories.
IGNORE is a list of names to ignore,
- defaults to ['RCS', 'CVS', 'tags'].
+ defaults to DEFAULT_IGNORES.
HIDE is a list of names to hide,
defaults to [os.curdir, os.pardir].
@@ -116,7 +120,7 @@ class dircmp:
else:
self.hide = hide
if ignore is None:
- self.ignore = ['RCS', 'CVS', 'tags'] # Names ignored in comparison
+ self.ignore = DEFAULT_IGNORES
else:
self.ignore = ignore