Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

commit: allow undo if undo.desc indicates a commit

undo.desc is a recent addition to Mercurial, so this will have no
effect unless you are using tip versions of hg.

Changeset 159972a055a3

Parent 05abe9117070

by Steve Borho

Changes to one file · Browse files at 159972a055a3 Showing diff from parent 05abe9117070 Diff from another changeset...

 
772
773
774
775
776
 
 
 
 
 
 
 
 
 
 
777
778
779
 
772
773
774
 
 
775
776
777
778
779
780
781
782
783
784
785
786
787
@@ -772,8 +772,16 @@
  self.branchbutton.set_label(text)     def check_undo(self): - can_undo = os.path.exists(self.repo.sjoin("undo")) and \ - self.last_commit_id is not None + can_undo = False + if os.path.exists(self.repo.sjoin('undo')): + can_undo = (self.last_commit_id is not None) + try: + # when hg-1.5 support is dropped, self.last_commit_id + # can be removed + args = self.repo.opener('undo.desc', 'r').read().split(',') + can_undo = args[1] == 'commit' + except (IOError, IndexError): + pass   self.cmd_set_sensitive('undo', can_undo)     def check_merge(self):