equal
deleted
inserted
replaced
63 from __future__ import absolute_import |
63 from __future__ import absolute_import |
64 |
64 |
65 import os |
65 import os |
66 import re |
66 import re |
67 import shutil |
67 import shutil |
|
68 import stat |
68 import tempfile |
69 import tempfile |
69 from mercurial.i18n import _ |
70 from mercurial.i18n import _ |
70 from mercurial.node import ( |
71 from mercurial.node import ( |
71 nullid, |
72 nullid, |
72 short, |
73 short, |
295 # The only certain way to detect every case is to diff all files, |
296 # The only certain way to detect every case is to diff all files, |
296 # which could be expensive. |
297 # which could be expensive. |
297 # copyfile() carries over the permission, so the mode check could |
298 # copyfile() carries over the permission, so the mode check could |
298 # be in an 'elif' branch, but for the case where the file has |
299 # be in an 'elif' branch, but for the case where the file has |
299 # changed without affecting mtime or size. |
300 # changed without affecting mtime or size. |
300 if (cpstat.st_mtime != st.st_mtime or cpstat.st_size != st.st_size |
301 if (cpstat[stat.ST_MTIME] != st[stat.ST_MTIME] |
|
302 or cpstat.st_size != st.st_size |
301 or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)): |
303 or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)): |
302 ui.debug('file changed while diffing. ' |
304 ui.debug('file changed while diffing. ' |
303 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) |
305 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) |
304 util.copyfile(copy_fn, working_fn) |
306 util.copyfile(copy_fn, working_fn) |
305 |
307 |