Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

commit/thgshelve: check if the shown state is up to date

Check if the parents have changed since the last refresh of the display before
doing commit or (un)shelve. If they have, ask the user if he wants to continue.

Fixes #277

Changeset 5b54efceb405

Parent 4d53aac5f184

by Simon Heimberg

Changes to 3 files · Browse files at 5b54efceb405 Showing diff from parent 4d53aac5f184 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​commit.py Stacked
 
307
308
309
310
 
311
312
313
 
421
422
423
424
 
425
426
427
 
307
308
309
 
310
311
312
313
 
421
422
423
 
424
425
426
427
@@ -307,7 +307,7 @@
    def get_custom_menus(self):   def commit(menuitem, files): - if self.ready_message(): + if self.ready_message() and self.isuptodate():   self.hg_commit(files)   self.reload_status()   abs = [self.repo.wjoin(file) for file in files] @@ -421,7 +421,7 @@
  self.branchbutton.set_sensitive(not (self.mqmode or self.qnew))     def commit_clicked(self, toolbutton, data=None): - if not self.ready_message(): + if not (self.ready_message() or self.isupdodate()):   return     commitable = 'MAR'
Change 1 of 1 Show Entire File hggtk/​status.py Stacked
 
1338
1339
1340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1341
1342
1343
 
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
@@ -1338,6 +1338,21 @@
  self._do_diff(files, self.opts)   return True   + def isuptodate(self): + oldparents = self.repo.dirstate.parents() + self.repo.dirstate.invalidate() + if oldparents == self.repo.dirstate.parents(): + return True + response = gdialog.CustomPrompt(_('not up to date'), + _('The parents have changed since the last refresh.\n' + 'Continue anyway?'), + self, (_('&Yes'), _('&Refresh'), _('&Cancel')), 1, 2).run() + if response == 0: # Yes + return True + if response == 1: + self.reload_status() + return False +  def run(ui, *pats, **opts):   showclean = pats and True or False   rev = opts.get('rev', [])
 
195
196
197
 
 
198
199
200
201
 
 
202
203
204
 
195
196
197
198
199
200
201
202
203
204
205
206
207
208
@@ -195,10 +195,14 @@
  pass     def shelve_clicked(self, toolbutton, data=None): + if not self.isuptodate(): + return   self.shelve_selected()   self.activate_shelve_buttons(True)     def unshelve_clicked(self, toolbutton, data=None): + if not self.isuptodate(): + return   self.unshelve()   self.activate_shelve_buttons(True)