File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,36 @@ def do(self):
286
286
self .model .update_file_status ()
287
287
288
288
289
+ class RevertUnstagedEdits (Command ):
290
+
291
+ SHORTCUT = 'Ctrl+U'
292
+
293
+ def do (self ):
294
+ if not self .model .undoable ():
295
+ return
296
+ s = selection .selection ()
297
+ if s .staged :
298
+ items_to_undo = s .staged
299
+ else :
300
+ items_to_undo = s .modified
301
+ if items_to_undo :
302
+ if not Interaction .confirm (N_ ('Revert Unstaged Changes?' ),
303
+ N_ ('This operation drops unstaged changes.\n '
304
+ 'These changes cannot be recovered.' ),
305
+ N_ ('Revert the unstaged changes?' ),
306
+ N_ ('Revert Unstaged Changes' ),
307
+ default = True ,
308
+ icon = resources .icon ('undo.svg' )):
309
+ return
310
+ args = []
311
+ if not s .staged and self .model .amending ():
312
+ args .append (self .model .head )
313
+ do (Checkout , args + ['--' ] + items_to_undo )
314
+ else :
315
+ msg = N_ ('No files selected for checkout from HEAD.' )
316
+ Interaction .log (msg )
317
+
318
+
289
319
class Commit (ResetMode ):
290
320
"""Attempt to create a new commit."""
291
321
You can’t perform that action at this time.
0 commit comments