Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.3, 2.0.4, and 2.0.5

stable rejects: Show warning message when saving the file without having modified it

The rejects tool did not make it 100% clear that you are supposed to _edit_ the
file using its built-in editor. A user may assume that it only needs to mark all
conflicts as resolved and hit save, which would (magically?) resolve these
conflicts.

This patch shows a warning message when the user marks all rejected patch chunks
without having modified the file.

Changeset 5d8da9e07ef2

Parent d16f372095e6

by Angel Ezquerra

Changes to one file · Browse files at 5d8da9e07ef2 Showing diff from parent d16f372095e6 Diff from another changeset...

 
178
179
180
181
182
183
184
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
187
188
 
178
179
180
 
 
 
 
 
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
@@ -178,11 +178,31 @@
  self.rejectbrowser.saveSettings(s, 'rejects/rejbrowse')     def accept(self): - f = QFile(self.path) - f.open(QIODevice.WriteOnly) - self.editor.write(f) - self.saveSettings() - super(RejectsDialog, self).accept() + # If the editor has been modified, we implicitly accept the changes + acceptresolution = self.editor.isModified() + if not acceptresolution: + action = QMessageBox.warning(self, + _("Warning"), + _("You have marked all rejected patch chunks as resolved yet you " \ + "have not modified the file on the edit panel.\n\n" \ + "This probably means that no code from any of the rejected patch " \ + "chunks made it into the file.\n\n"\ + "Are you sure that you want to leave the file as is and " \ + "consider all the rejected patch chunks as resolved?\n\n" \ + "Doing so may delete them from a shelve, for example, which " \ + "would mean that you would lose them forever!\n\n" + "Click Yes to accept the file as is or No to continue resolving " \ + "the rejected patch chunks."), + QMessageBox.Yes, QMessageBox.No) + if action == QMessageBox.Yes: + acceptresolution = True + + if acceptresolution: + f = QFile(self.path) + f.open(QIODevice.WriteOnly) + self.editor.write(f) + self.saveSettings() + super(RejectsDialog, self).accept()     def reject(self):   self.saveSettings()