Commits

Yuya Nishihara  committed 084b8c7

chunks: keep permission of working-copy file by atomictemp (fixes #2414)

Without atomictemp, opener unlinks the existing file first, so its permission
is not preserved. atomictempfile copies the permission explicitly.

  • Participants
  • Parent commits 99cd9f1
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/chunks.py

             else:
                 wlock = repo.wlock()
                 try:
-                    repo.wopener(self.currentFile, 'wb').write(
-                        self.diffbrowse.origcontents)
+                    # atomictemp can preserve file permission
+                    wf = repo.wopener(self.currentFile, 'wb', atomictemp=True)
+                    wf.write(self.diffbrowse.origcontents)
+                    wf.close()
                     fp = cStringIO.StringIO()
                     chunks[0].write(fp)
                     for c in kchunks: