Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable merge: "Cancel" and wait for the status check thread when canceling the Dialog

Not doing this causes a traceback when the thread ends

Changeset 286f57d051e5

Parent 0f5e4b065ef2

by Daniel Atallah

Changes to one file · Browse files at 286f57d051e5 Showing diff from parent 0f5e4b065ef2 Diff from another changeset...

 
65
66
67
 
68
69
70
 
98
99
100
 
 
 
101
102
103
 
206
207
208
 
209
210
211
 
423
424
425
 
 
 
 
 
426
427
428
 
500
501
502
 
503
504
505
506
 
 
507
508
509
 
511
512
513
 
 
 
514
 
 
515
516
517
 
65
66
67
68
69
70
71
 
99
100
101
102
103
104
105
106
107
 
210
211
212
213
214
215
216
 
428
429
430
431
432
433
434
435
436
437
438
 
510
511
512
513
514
515
516
517
518
519
520
521
522
 
524
525
526
527
528
529
530
531
532
533
534
535
@@ -65,6 +65,7 @@
  if not qtlib.QuestionMsgBox(_('Confirm Exit'), main, text,   labels=labels, parent=self):   return + page.reject()   super(MergeDialog, self).reject()    MAIN_PANE = 0 @@ -98,6 +99,9 @@
  'repository has detected a change to config files'   pass   + def reject(self): + pass +   def initializePage(self):   if self.layout():   return @@ -206,6 +210,7 @@
    self.clean = None   self.undo = False + self.th = None     ### Override Methods ###   @@ -423,6 +428,11 @@
  self.local_info.update(pctx)   self.wizard().local = str(pctx.rev())   + def reject(self): + if self.th is not None and not self.th.isFinished(): + self.th.cancel() + self.th.wait() +   def show_options(self, visible):   self.discard_chk.setShown(visible)   self.autoresolve_chk.setShown(visible) @@ -500,10 +510,13 @@
  def __init__(self, parent):   QThread.__init__(self, parent)   self.results = (False, 1) + self.canceled = False     def run(self):   unresolved = False   for root, path, status in thgrepo.recursiveMergeStatus(repo): + if self.canceled: + return   if status == 'u':   unresolved = True   break @@ -511,7 +524,12 @@
  dirty = bool(wctx.dirty()) or unresolved   self.results = (dirty, len(wctx.parents()))   + def cancel(self): + self.canceled = True +   def completed(): + if self.th.canceled: + return   self.th.wait()   dirty, parents = self.th.results   self.clean = not dirty