Show More
@@ -10,7 +10,7 b'' | |||
|
10 | 10 | from mercurial.i18n import gettext, _ |
|
11 | 11 | from mercurial import cmdutil, commands, extensions, hg, mdiff, patch |
|
12 | 12 | from mercurial import util |
|
13 | import copy, cStringIO, errno, os, re, tempfile | |
|
13 | import copy, cStringIO, errno, os, re, shutil, tempfile | |
|
14 | 14 | |
|
15 | 15 | lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)') |
|
16 | 16 | |
@@ -475,6 +475,7 b' def dorecord(ui, repo, commitfunc, *pats' | |||
|
475 | 475 | os.close(fd) |
|
476 | 476 | ui.debug('backup %r as %r\n' % (f, tmpname)) |
|
477 | 477 | util.copyfile(repo.wjoin(f), tmpname) |
|
478 | shutil.copystat(repo.wjoin(f), tmpname) | |
|
478 | 479 | backups[f] = tmpname |
|
479 | 480 | |
|
480 | 481 | fp = cStringIO.StringIO() |
@@ -521,6 +522,14 b' def dorecord(ui, repo, commitfunc, *pats' | |||
|
521 | 522 | for realname, tmpname in backups.iteritems(): |
|
522 | 523 | ui.debug('restoring %r to %r\n' % (tmpname, realname)) |
|
523 | 524 | util.copyfile(tmpname, repo.wjoin(realname)) |
|
525 | # Our calls to copystat() here and above are a | |
|
526 | # hack to trick any editors that have f open that | |
|
527 | # we haven't modified them. | |
|
528 | # | |
|
529 | # Also note that this racy as an editor could | |
|
530 | # notice the file's mtime before we've finished | |
|
531 | # writing it. | |
|
532 | shutil.copystat(tmpname, repo.wjoin(realname)) | |
|
524 | 533 | os.unlink(tmpname) |
|
525 | 534 | os.rmdir(backupdir) |
|
526 | 535 | except OSError: |
General Comments 0
You need to be logged in to leave comments.
Login now