hgext/extdiff.py
changeset 32283 8a1ff5ed620e
parent 32217 affd753ddaf1
child 32337 46ba2cdda476
--- a/hgext/extdiff.py	Sat May 13 12:14:24 2017 -0700
+++ b/hgext/extdiff.py	Thu May 11 22:33:45 2017 -0400
@@ -280,7 +280,11 @@
             # all changes.  A size check will detect more cases, but not all.
             # The only certain way to detect every case is to diff all files,
             # which could be expensive.
-            if cpstat.st_mtime != st.st_mtime or cpstat.st_size != st.st_size:
+            # copyfile() carries over the permission, so the mode check could
+            # be in an 'elif' branch, but for the case where the file has
+            # changed without affecting mtime or size.
+            if (cpstat.st_mtime != st.st_mtime or cpstat.st_size != st.st_size
+                or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)):
                 ui.debug('file changed while diffing. '
                          'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn))
                 util.copyfile(copy_fn, working_fn)