##// END OF EJS Templates
record: don't dereference symlinks while copying over stat data...
Siddharth Agarwal -
r27370:d9e3ebe5 stable
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7 7
8 8 from node import hex, bin, nullid, nullrev, short
9 9 from i18n import _
10 import os, sys, errno, re, tempfile, cStringIO, shutil
10 import os, sys, errno, re, tempfile, cStringIO
11 11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 12 import match as matchmod
13 13 import repair, graphmod, revset, phases, obsolete, pathutil
@@ -166,8 +166,7 b' def dorecord(ui, repo, commitfunc, cmdsu'
166 166 dir=backupdir)
167 167 os.close(fd)
168 168 ui.debug('backup %r as %r\n' % (f, tmpname))
169 util.copyfile(repo.wjoin(f), tmpname)
170 shutil.copystat(repo.wjoin(f), tmpname)
169 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
171 170 backups[f] = tmpname
172 171
173 172 fp = cStringIO.StringIO()
@@ -216,15 +215,12 b' def dorecord(ui, repo, commitfunc, cmdsu'
216 215 # to be treated as unmodified
217 216 dirstate.normallookup(realname)
218 217
219 util.copyfile(tmpname, repo.wjoin(realname))
220 # Our calls to copystat() here and above are a
221 # hack to trick any editors that have f open that
222 # we haven't modified them.
218 # copystat=True here and above are a hack to trick any
219 # editors that have f open that we haven't modified them.
223 220 #
224 # Also note that this racy as an editor could
225 # notice the file's mtime before we've finished
226 # writing it.
227 shutil.copystat(tmpname, repo.wjoin(realname))
221 # Also note that this racy as an editor could notice the
222 # file's mtime before we've finished writing it.
223 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
228 224 os.unlink(tmpname)
229 225 if tobackup:
230 226 os.rmdir(backupdir)
General Comments 0
You need to be logged in to leave comments. Login now