Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py

changeset 1297
6347cf782036
parent 1256
885706dbb69f
child 1300
9083f6b7ea3b
equal deleted inserted replaced
1295:b3db3070d104 1297:6347cf782036
12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QFileInfo, Qt 12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QFileInfo, Qt
13 from PyQt4.QtGui import QWidget, QDialogButtonBox, QBrush, QColor, \ 13 from PyQt4.QtGui import QWidget, QDialogButtonBox, QBrush, QColor, \
14 QTextCursor, QLineEdit 14 QTextCursor, QLineEdit
15 15
16 from E5Gui import E5MessageBox, E5FileDialog 16 from E5Gui import E5MessageBox, E5FileDialog
17 from E5Gui.E5Application import e5App
17 18
18 from .Ui_HgDiffDialog import Ui_HgDiffDialog 19 from .Ui_HgDiffDialog import Ui_HgDiffDialog
19 20
20 import Utilities 21 import Utilities
21 import Preferences 22 import Preferences
337 icon=E5MessageBox.Warning) 338 icon=E5MessageBox.Warning)
338 if not res: 339 if not res:
339 return 340 return
340 fname = Utilities.toNativeSeparators(fname) 341 fname = Utilities.toNativeSeparators(fname)
341 342
343 eol = e5App().getObject("Project").getEolString()
342 try: 344 try:
343 f = open(fname, "w", encoding="utf-8") 345 f = open(fname, "w", encoding="utf-8")
344 f.write(self.contents.toPlainText()) 346 f.write(eol.join(self.contents.toPlainText().splitlines()))
345 f.close() 347 f.close()
346 except IOError as why: 348 except IOError as why:
347 E5MessageBox.critical(self, self.trUtf8('Save Diff'), 349 E5MessageBox.critical(self, self.trUtf8('Save Diff'),
348 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' 350 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.'
349 '<br>Reason: {1}</p>') 351 '<br>Reason: {1}</p>')

eric ide

mercurial