eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py

changeset 7785
9978016560ec
parent 7779
757334671130
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
237 return 237 return
238 fname = Utilities.toNativeSeparators(fname) 238 fname = Utilities.toNativeSeparators(fname)
239 239
240 eol = e5App().getObject("Project").getEolString() 240 eol = e5App().getObject("Project").getEolString()
241 try: 241 try:
242 f = open(fname, "w", encoding="utf-8", newline="") 242 with open(fname, "w", encoding="utf-8", newline="") as f:
243 f.write(eol.join(self.contents.toPlainText().splitlines())) 243 f.write(eol.join(self.contents.toPlainText().splitlines()))
244 f.close()
245 except IOError as why: 244 except IOError as why:
246 E5MessageBox.critical( 245 E5MessageBox.critical(
247 self, self.tr('Save Diff'), 246 self, self.tr('Save Diff'),
248 self.tr( 247 self.tr(
249 '<p>The patch file <b>{0}</b> could not be saved.' 248 '<p>The patch file <b>{0}</b> could not be saved.'

eric ide

mercurial