~ubuntu-branches/debian/sid/tortoisehg/sid

« back to all changes in this revision

Viewing changes to tortoisehg/hgqt/status.py

  • Committer: Package Import Robot
  • Author(s): Ludovico Cavedon
  • Date: 2012-02-20 22:03:12 UTC
  • mfrom: (1.2.8)
  • Revision ID: package-import@ubuntu.com-20120220220312-11yhqpn8suxvwyg4
Tags: 2.3-1
* Imported Upstream version 2.3 (Closes: #660387, #658140).
* Update dependency on Merurual (2.1, 2.2).

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    showMessage = pyqtSignal(unicode)
49
49
    fileDisplayed = pyqtSignal(QString, QString)
50
50
 
51
 
    def __init__(self, repo, pats, opts, parent=None, checkable=True):
 
51
    def __init__(self, repo, pats, opts, parent=None, checkable=True,
 
52
                 defcheck='MAR!S'):
52
53
        QWidget.__init__(self, parent)
53
54
 
54
55
        self.opts = dict(modified=True, added=True, removed=True, deleted=True,
57
58
        self.repo = repo
58
59
        self.pats = pats
59
60
        self.checkable = checkable
 
61
        self.defcheck = defcheck
60
62
        self.pctx = None
61
63
        self.savechecks = True
62
64
        self.refthread = None
131
133
        self.filelistToolbar.addWidget(self.statusfilter)
132
134
        self.filelistToolbar.addSeparator()
133
135
        self.filelistToolbar.addWidget(self.refreshBtn)
134
 
        self.actions = wctxactions.WctxActions(self.repo, self)
 
136
        self.actions = wctxactions.WctxActions(self.repo, self, checkable)
135
137
        tv = WctxFileTree(self.repo, checkable=checkable)
136
138
        vbox.addLayout(hbox)
137
139
        vbox.addWidget(tv)
285
287
                                    parent=self)
286
288
        ms = merge.mergestate(self.repo)
287
289
        tm = WctxModel(wctx, ms, self.pctx, self.savechecks, self.opts,
288
 
                       checked, self, checkable=self.checkable)
 
290
                       checked, self, checkable=self.checkable,
 
291
                       defcheck=self.defcheck)
289
292
        if self.checkable:
290
293
            tm.checkToggled.connect(self.updateCheckCount)
291
294
 
415
418
 
416
419
    def __init__(self, repo, pctx, pats, opts, parent=None):
417
420
        super(StatusThread, self).__init__()
418
 
        self.repo = thgrepo.repository(repo.ui, repo.root)
 
421
        self.repo = hg.repository(repo.ui, repo.root)
419
422
        self.pctx = pctx
420
423
        self.pats = pats
421
424
        self.opts = opts
550
553
class WctxModel(QAbstractTableModel):
551
554
    checkToggled = pyqtSignal()
552
555
 
553
 
    def __init__(self, wctx, ms, pctx, savechecks, opts, checked, parent, checkable=True):
 
556
    def __init__(self, wctx, ms, pctx, savechecks, opts, checked, parent,
 
557
                 checkable=True, defcheck='MAR!S'):
554
558
        QAbstractTableModel.__init__(self, parent)
555
559
        self.checkCount = 0
556
560
        rows = []
577
581
            pctxmatch = lambda f: True
578
582
        if opts['modified']:
579
583
            for m in wctx.modified():
580
 
                nchecked[m] = checked.get(m, m not in excludes and pctxmatch(m))
 
584
                nchecked[m] = checked.get(m, 'M' in defcheck and
 
585
                                          m not in excludes and pctxmatch(m))
581
586
                rows.append(mkrow(m, 'M'))
582
587
        if opts['added']:
583
588
            for a in wctx.added():
584
 
                nchecked[a] = checked.get(a, a not in excludes and pctxmatch(a))
 
589
                nchecked[a] = checked.get(a, 'A' in defcheck and
 
590
                                          a not in excludes and pctxmatch(a))
585
591
                rows.append(mkrow(a, 'A'))
586
592
        if opts['removed']:
587
593
            for r in wctx.removed():
588
 
                nchecked[r] = checked.get(r, r not in excludes and pctxmatch(r))
 
594
                nchecked[r] = checked.get(r, 'R' in defcheck and
 
595
                                          r not in excludes and pctxmatch(r))
589
596
                rows.append(mkrow(r, 'R'))
590
597
        if opts['deleted']:
591
598
            for d in wctx.deleted():
592
 
                nchecked[d] = checked.get(d, d not in excludes and pctxmatch(d))
 
599
                nchecked[d] = checked.get(d, 'D' in defcheck and
 
600
                                          d not in excludes and pctxmatch(d))
593
601
                rows.append(mkrow(d, '!'))
594
602
        if opts['unknown']:
595
603
            for u in wctx.unknown() or []:
596
 
                nchecked[u] = checked.get(u, False)
 
604
                nchecked[u] = checked.get(u, '?' in defcheck)
597
605
                rows.append(mkrow(u, '?'))
598
606
        if opts['ignored']:
599
607
            for i in wctx.ignored() or []:
600
 
                nchecked[i] = checked.get(i, False)
 
608
                nchecked[i] = checked.get(i, 'I' in defcheck)
601
609
                rows.append(mkrow(i, 'I'))
602
610
        if opts['clean']:
603
611
            for c in wctx.clean() or []:
604
 
                nchecked[c] = checked.get(c, False)
 
612
                nchecked[c] = checked.get(c, 'C' in defcheck)
605
613
                rows.append(mkrow(c, 'C'))
606
614
        if opts['subrepo']:
607
615
            for s in wctx.dirtySubrepos:
608
 
                nchecked[s] = checked.get(s, True)
 
616
                nchecked[s] = checked.get(s, 'S' in defcheck)
609
617
                rows.append(mkrow(s, 'S'))
610
618
        # include clean unresolved files
611
619
        for f in ms:
624
632
            return 0 # no child
625
633
        return len(self.rows)
626
634
 
 
635
    def check(self, files, state=True):
 
636
        for f in files:
 
637
            self.checked[f] = state
 
638
        self.layoutChanged.emit()
 
639
        self.checkToggled.emit()
 
640
        
627
641
    def checkAll(self, state):
628
642
        for data in self.rows:
629
643
            self.checked[data[0]] = state
725
739
            try:
726
740
                rank = sortList.index(value)
727
741
            except (IndexError, ValueError):
728
 
                rank = len(shortList) # Set the lowest rank by default
 
742
                rank = len(sortList) # Set the lowest rank by default
729
743
 
730
744
            return rank
731
745
 
740
754
            try:
741
755
                rank = sortList.index(value)
742
756
            except (IndexError, ValueError):
743
 
                rank = len(shortList) # Set the lowest rank by default
 
757
                rank = len(sortList) # Set the lowest rank by default
744
758
 
745
759
            return rank
746
760