diff mercurial/cmdutil.py @ 37091:08890706366e

copyfile: preserve stat info (mtime, etc.) when doing copies/renames Differential Revision: https://phab.mercurial-scm.org/D2729
author Kyle Lippincott <spectral@google.com>
date Thu, 08 Mar 2018 11:44:03 -0800
parents f0b6fbea00cf
children be3f33f5e232
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Mar 22 22:58:31 2018 -0400
+++ b/mercurial/cmdutil.py	Thu Mar 08 11:44:03 2018 -0800
@@ -1192,7 +1192,9 @@
                     os.rename(src, tmp)
                     os.rename(tmp, target)
                 else:
-                    util.copyfile(src, target)
+                    # Preserve stat info on renames, not on copies; this matches
+                    # Linux CLI behavior.
+                    util.copyfile(src, target, copystat=rename)
                 srcexists = True
             except IOError as inst:
                 if inst.errno == errno.ENOENT: