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

stable status: improve sort by merge status (sort in S, U, R order)

This is similar to 37bb954d6916, but for the merge status column (rather than
for the status column).

Changeset 621b71486c09

Parent 0e4775965ac4

by Angel Ezquerra

Changes to one file · Browse files at 621b71486c09 Showing diff from parent 0e4775965ac4 Diff from another changeset...

 
617
618
619
620
 
621
622
 
623
624
625
626
627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
629
630
 
657
658
659
 
 
660
661
662
 
617
618
619
 
620
621
 
622
623
624
625
 
 
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
 
672
673
674
675
676
677
678
679
@@ -617,14 +617,29 @@
  """Helper function used to sort items according to their hg status     Statuses are ranked in the following order: - 'S','M','A','R','!','?','C','I' + 'S','M','A','R','!','?','C','I',''   """ - sortList = ['S','M','A','R','!','?','C','I'] + sortList = ['S','M','A','R','!','?','C','I','']     try:   rank = sortList.index(value) - except IndexError, e: - rank = len(shortList) + except (IndexError, ValueError): + rank = len(shortList) # Set the lowest rank by default + + return rank + + def getMergeStatusRank(value): + """Helper function used to sort according to item merge status + + Merge statuses are ranked in the following order: + 'S','U','R','' + """ + sortList = ['S','U','R',''] + + try: + rank = sortList.index(value) + except (IndexError, ValueError): + rank = len(shortList) # Set the lowest rank by default     return rank   @@ -657,6 +672,8 @@
  self.rows.sort(lambda x, y: cmp(c[x[col]], c[y[col]]))   elif col == COL_STATUS:   self.rows.sort(key=lambda x: getStatusRank(x[col])) + elif col == COL_MERGE_STATE: + self.rows.sort(key=lambda x: getMergeStatusRank(x[col]))   else:   self.rows.sort(lambda x, y: cmp(x[col], y[col]))