From b659c008b995317337875136c69158840e56ed80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Kandemir?= Date: Tue, 20 Jan 2009 12:46:56 +0000 Subject: [PATCH] By default, filecmp.cmp() compares two files by looking file sizes. shallow=False tells cmp() to look file content. --- pisi/actionsapi/pisitools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pisi/actionsapi/pisitools.py b/pisi/actionsapi/pisitools.py index b4389604..59bab213 100644 --- a/pisi/actionsapi/pisitools.py +++ b/pisi/actionsapi/pisitools.py @@ -208,7 +208,9 @@ def dosed(sourceFiles, findPattern, replacePattern = ''): line = re.sub(findPattern, replacePattern, line) sys.stdout.write(line) if can_access_file(backupFile): - if filecmp.cmp(sourceFile, backupFile): + # By default, filecmp.cmp() compares two files by looking file sizes. + # shallow=False tells cmp() to look file content. + if filecmp.cmp(sourceFile, backupFile, shallow=False): ctx.ui.warning(_('dosed method has not changed file \'%s\'.') % sourceFile) else: os.unlink(backupFile)