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

status: move repo.status() call into a separate function

Prep work for making repo.status threaded and adding a progress bar

Changeset f5849818381a

Parent 4ff888964b7d

by Steve Borho

Changes to 2 files · Browse files at f5849818381a Showing diff from parent 4ff888964b7d Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​commit.py Stacked
 
555
556
557
558
 
559
560
561
 
555
556
557
 
558
559
560
561
@@ -555,7 +555,7 @@
  allchunks = []   for f in files:   cf = util.pconvert(f) - if cf not in self.modified: continue + if cf not in self.status[0]: continue   if f not in self.filechunks: continue   chunks = self.filechunks[f]   if len(chunks) < 2: continue
Change 1 of 4 Show Entire File hggtk/​status.py Stacked
 
526
527
528
529
 
530
531
532
 
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
 
562
563
564
 
577
578
579
580
 
581
582
583
 
622
623
624
625
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
 
627
628
629
 
526
527
528
 
529
530
531
532
 
535
536
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
539
540
541
 
554
555
556
 
557
558
559
560
 
599
600
601
 
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
@@ -526,7 +526,7 @@
  fp.seek(0)   self.clipboard.set_text(fp.read())   - def do_reload_status(self): + def refresh_file_tree(self):   """Clear out the existing ListStore model and reload it from the   repository status. Also recheck and reselect files that remain   in the list. @@ -535,30 +535,7 @@
  if selection is None:   return   - repo = self.repo - hglib.invalidaterepo(repo) - if hasattr(repo, 'mq'): - self.mqmode = repo.mq.applied and repo['.'] == repo['qtip'] - self.set_title(self.get_title()) - - if self.mqmode and self.mode != 'status': - # when a patch is applied, show diffs to parent of top patch - qtip = repo['.'] - n1 = qtip.parents()[0].node() - n2 = None - else: - # node2 is None (the working dir) when 0 or 1 rev is specificed - n1, n2 = cmdutil.revpair(repo, self.opts.get('rev')) - - matcher = cmdutil.match(repo, self.pats, self.opts) - status = repo.status(node1=n1, node2=n2, match=matcher, - ignored=self.test_opt('ignored'), - clean=self.test_opt('clean'), - unknown=self.test_opt('unknown')) - - (modified, added, removed, deleted, unknown, ignored, clean) = status - self._node1, self._node2, self.modified = n1, n2, modified - + (modified, added, removed, deleted, unknown, ignored, clean) = self.status   changetypes = (('M', 'modified', modified),   ('A', 'added', added),   ('R', 'removed', removed), @@ -577,7 +554,7 @@
  waschecked[row[FM_PATH]] = row[FM_CHECKED], row[FM_PARTIAL_SELECTED]     # merge-state of files - ms = merge_.mergestate(repo) + ms = merge_.mergestate(self.repo)     # Load the new data into the tree's model   self.filetree.hide() @@ -622,8 +599,37 @@
    def reload_status(self):   if not self.ready: return False - self.do_reload_status() + + def get_repo_status(): + repo = self.repo + hglib.invalidaterepo(repo) + if hasattr(repo, 'mq'): + self.mqmode = repo.mq.applied and repo['.'] == repo['qtip'] + self.set_title(self.get_title()) + + if self.mqmode and self.mode != 'status': + # when a patch is applied, show diffs to parent of top patch + qtip = repo['.'] + n1 = qtip.parents()[0].node() + n2 = None + else: + # node2 is None (the working dir) when 0 or 1 rev is specificed + n1, n2 = cmdutil.revpair(repo, self.opts.get('rev')) + + matcher = cmdutil.match(repo, self.pats, self.opts) + status = repo.status(node1=n1, node2=n2, match=matcher, + ignored=self.test_opt('ignored'), + clean=self.test_opt('clean'), + unknown=self.test_opt('unknown')) + + self.status = status + self._node1, self._node2, = n1, n2 + + self.ready = False + get_repo_status() + self.refresh_file_tree()   self.update_check_count() + self.ready = True       def select_toggle(self, cellrenderer, path):