Example #1
0
 def isComplete(self):
     'should Next button be sensitive?'
     if not self.mergecomplete:
         return False
     count = 0
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             count += 1
     if count:
         if self.field('autoresolve').toBool():
             # if autoresolve is enabled, we know these were real conflicts
             self.reslabel.setText(
                 _('%d files have <b>merge conflicts</b> '
                   'that must be <a href="resolve">'
                   '<b>resolved</b></a>') % count)
         else:
             # else give a calmer indication of conflicts
             self.reslabel.setText(
                 _('%d files were modified on both '
                   'branches and must be <a href="resolve">'
                   '<b>resolved</b></a>') % count)
         return False
     else:
         self.reslabel.setText(_('No merge conflicts, ready to commit'))
     return True
Example #2
0
 def isComplete(self):
     'should Next button be sensitive?'
     if not self.mergecomplete:
         return False
     ucount = 0
     rcount = 0
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             ucount += 1
         if status == 'r':
             rcount += 1
     if ucount:
         if self.field('autoresolve').toBool():
             # if autoresolve is enabled, we know these were real conflicts
             self.reslabel.setText(_('%d files have <b>merge conflicts</b> '
                                     'that must be <a href="resolve">'
                                     '<b>resolved</b></a>') % ucount)
         else:
             # else give a calmer indication of conflicts
             self.reslabel.setText(_('%d files were modified on both '
                                     'branches and must be <a href="resolve">'
                                     '<b>resolved</b></a>') % ucount)
         return False
     elif rcount:
         self.reslabel.setText(_('No merge conflicts, ready to commit or '
                                 '<a href="resolve"><b>review</b></a>'))
     else:
         self.reslabel.setText(_('No merge conflicts, ready to commit'))
     return True
Example #3
0
 def isComplete(self):
     "should Next button be sensitive?"
     if not self.mergecomplete:
         return False
     count = 0
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == "u":
             count += 1
     if count:
         if self.field("autoresolve").toBool():
             # if autoresolve is enabled, we know these were real conflicts
             self.reslabel.setText(
                 _("%d files have <b>merge conflicts</b> " 'that must be <a href="resolve">' "<b>resolved</b></a>")
                 % count
             )
         else:
             # else give a calmer indication of conflicts
             self.reslabel.setText(
                 _("%d files were modified on both " 'branches and must be <a href="resolve">' "<b>resolved</b></a>")
                 % count
             )
         return False
     else:
         self.reslabel.setText(_("No merge conflicts, ready to commit"))
     return True
Example #4
0
    def checkResolve(self):
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == 'u':
                txt = _('Graft generated merge <b>conflicts</b> that must '
                        'be <a href="resolve"><b>resolved</b></a>')
                self.graftbtn.setEnabled(False)
                break
        else:
            self.graftbtn.setEnabled(True)
            txt = _('You may continue the graft')
        self.showMessage.emit(txt)

        currgraftrevs = self.graftstate()
        if currgraftrevs:
            def findrev(rev, revlist):
                rev = self.repo[rev].rev()
                for n, r in enumerate(revlist):
                    r = self.repo[r].rev()
                    if rev == r:
                        return n
                return None
            idx = findrev(currgraftrevs[0], self.sourcelist)
            if idx is not None:
                self._updateSource(idx)
            self.abortbtn.setEnabled(True)
            self.graftbtn.setText('Continue')
            return True
        else:
            self.abortbtn.setEnabled(False)
            return False
Example #5
0
 def accept(self):
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             qtlib.InfoMsgBox(_('Merge caused file conflicts'),
                              _('File conflicts need to be resolved'))
             dlg = resolve.ResolveDialog(self.repo, self)
             dlg.finished.connect(dlg.deleteLater)
             dlg.exec_()
             break
     super(UpdateDialog, self).accept()
Example #6
0
 def accept(self):
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             qtlib.InfoMsgBox(_('Merge caused file conflicts'),
                              _('File conflicts need to be resolved'))
             dlg = resolve.ResolveDialog(self._repoagent, self)
             dlg.finished.connect(dlg.deleteLater)
             dlg.exec_()
             break
     super(UpdateDialog, self).accept()
Example #7
0
 def run(self):
     wctx = repo[None]
     if len(wctx.parents()) > 1:
         self.dirty = True
     elif wctx.dirty():
         self.dirty = True
     else:
         for r, p, status in thgrepo.recursiveMergeStatus(repo):
             if status == 'u':
                 self.dirty = True
                 break
Example #8
0
 def run(self):
     wctx = repo[None]
     if len(wctx.parents()) > 1:
         self.dirty = True
     elif wctx.dirty():
         self.dirty = True
     else:
         for r, p, status in thgrepo.recursiveMergeStatus(repo):
             if status == 'u':
                 self.dirty = True
                 break
Example #9
0
 def run(self):
     self.repo.dirstate.invalidate()
     unresolved = False
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if self.canceled:
             return
         if status == 'u':
             unresolved = True
             break
     wctx = self.repo[None]
     dirty = bool(wctx.dirty()) or unresolved
     self.results = (dirty, len(wctx.parents()))
Example #10
0
 def run(self):
     self.repo.dirstate.invalidate()
     unresolved = False
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if self.canceled:
             return
         if status == 'u':
             unresolved = True
             break
     wctx = self.repo[None]
     dirty = bool(wctx.dirty()) or unresolved
     self.results = (dirty, len(wctx.parents()))
Example #11
0
    def refresh(self):
        u, r = [], []
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == 'u':
                u.append((root, path))
            else:
                r.append((root, path))
        paths = self.getSelectedPaths(self.utree)
        oldmodel = self.utree.model()
        self.utree.setModel(PathsModel(u, self))
        self.utree.resizeColumnToContents(0)
        self.utree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.utree.model()
        smodel = self.utree.selectionModel()
        sflags = QItemSelectionModel.Select | QItemSelectionModel.Rows
        for i, path in enumerate(u):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)

        smodel.selectionChanged.connect(self._updateUnresolvedActions)
        self._updateUnresolvedActions()

        paths = self.getSelectedPaths(self.rtree)
        oldmodel = self.rtree.model()
        self.rtree.setModel(PathsModel(r, self))
        self.rtree.resizeColumnToContents(0)
        self.rtree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.rtree.model()
        smodel = self.rtree.selectionModel()
        for i, path in enumerate(r):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)

        smodel.selectionChanged.connect(self._updateResolvedActions)
        self._updateResolvedActions()

        if u:
            txt = _('There are merge <b>conflicts</b> to be resolved')
        elif r:
            txt = _('All conflicts are resolved.')
        else:
            txt = _('There are no conflicting file merges.')
        self.stlabel.setText(u'<h2>' + txt + u'</h2>')
Example #12
0
 def run(self):
     self.repo.invalidate()
     self.repo.dirstate.invalidate()
     unresolved = False
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if self.canceled:
             return
         if status == 'u':
             unresolved = True
             break
     wctx = self.repo[None]
     try:
         dirty = _checkchanged(self.repo) or unresolved
         self.results = (dirty, len(wctx.parents()))
     except EnvironmentError:
         self.results = (True, len(wctx.parents()))
Example #13
0
 def isComplete(self):
     'should Next button be sensitive?'
     if not self.backoutcomplete:
         return False
     count = 0
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             count += 1
     if count:
         # if autoresolve is enabled, we know these were real conflicts
         self.reslabel.setText(_('%d files have <b>merge conflicts</b> '
                                 'that must be <a href="resolve">'
                                 '<b>resolved</b></a>') % count)
         return False
     else:
         self.reslabel.setText(_('No merge conflicts, ready to commit'))
         return True
Example #14
0
 def isComplete(self):
     'should Next button be sensitive?'
     if not self.backoutcomplete:
         return False
     count = 0
     for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
         if status == 'u':
             count += 1
     if count:
         # if autoresolve is enabled, we know these were real conflicts
         self.reslabel.setText(
             _('%d files have <b>merge conflicts</b> '
               'that must be <a href="resolve">'
               '<b>resolved</b></a>') % count)
         return False
     else:
         self.reslabel.setText(_('No merge conflicts, ready to commit'))
         return True
Example #15
0
    def checkResolve(self):
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == 'u':
                txt = _('Rebase generated merge <b>conflicts</b> that must '
                        'be <a href="resolve"><b>resolved</b></a>')
                self.rebasebtn.setEnabled(False)
                break
        else:
            self.rebasebtn.setEnabled(True)
            txt = _('You may continue the rebase')
        self.showMessage.emit(txt)

        if os.path.exists(self.repo.join('rebasestate')):
            self.abortbtn.setEnabled(True)
            self.rebasebtn.setText('Continue')
            return True
        else:
            self.abortbtn.setEnabled(False)
            return False
Example #16
0
    def checkResolve(self):
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == 'u':
                txt = _('Rebase generated merge <b>conflicts</b> that must '
                        'be <a href="resolve"><b>resolved</b></a>')
                self.rebasebtn.setEnabled(False)
                break
        else:
            self.rebasebtn.setEnabled(True)
            txt = _('You may continue the rebase')
        self.showMessage.emit(txt)

        if os.path.exists(self.repo.join('rebasestate')):
            self.abortbtn.setEnabled(True)
            self.rebasebtn.setText('Continue')
            return True
        else:
            self.abortbtn.setEnabled(False)
            return False
Example #17
0
    def refresh(self):
        repo = self.repo

        u, r = [], []
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == "u":
                u.append((root, path))
            else:
                r.append((root, path))
        paths = self.getSelectedPaths(self.utree)
        oldmodel = self.utree.model()
        self.utree.setModel(PathsModel(u, self))
        self.utree.resizeColumnToContents(0)
        self.utree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.utree.model()
        smodel = self.utree.selectionModel()
        sflags = QItemSelectionModel.Select | QItemSelectionModel.Columns
        for i, path in enumerate(u):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)
                smodel.select(model.index(i, 1), sflags)
                smodel.select(model.index(i, 2), sflags)

        @pyqtSlot(QItemSelection, QItemSelection)
        def uchanged(selected, deselected):
            enable = self.utree.selectionModel().hasSelection()
            for b in self.ubuttons:
                b.setEnabled(enable)
            for c in self.umenuitems:
                c.setEnabled(enable)

        smodel.selectionChanged.connect(uchanged)
        uchanged(None, None)

        paths = self.getSelectedPaths(self.rtree)
        oldmodel = self.rtree.model()
        self.rtree.setModel(PathsModel(r, self))
        self.rtree.resizeColumnToContents(0)
        self.rtree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.rtree.model()
        smodel = self.rtree.selectionModel()
        for i, path in enumerate(r):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)
                smodel.select(model.index(i, 1), sflags)
                smodel.select(model.index(i, 2), sflags)

        @pyqtSlot(QItemSelection, QItemSelection)
        def rchanged(selected, deselected):
            enable = self.rtree.selectionModel().hasSelection()
            for b in self.rbuttons:
                b.setEnabled(enable)
            for c in self.rmenuitems:
                c.setEnabled(enable)
            merge = len(self.repo.parents()) > 1
            for b in self.rmbuttons:
                b.setEnabled(enable and merge)
            for c in self.rmmenuitems:
                c.setEnabled(enable and merge)

        smodel.selectionChanged.connect(rchanged)
        rchanged(None, None)

        if u:
            txt = _("There are merge <b>conflicts</b> to be resolved")
        elif r:
            txt = _("All conflicts are resolved.")
        else:
            txt = _("There are no conflicting file merges.")
        self.stlabel.setText(u"<h2>" + txt + u"</h2>")
Example #18
0
    def refresh(self):
        repo = self.repo

        u, r = [], []
        for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
            if status == 'u':
                u.append((root, path))
            else:
                r.append((root, path))
        paths = self.getSelectedPaths(self.utree)
        oldmodel = self.utree.model()
        self.utree.setModel(PathsModel(u, self))
        self.utree.resizeColumnToContents(0)
        self.utree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.utree.model()
        smodel = self.utree.selectionModel()
        sflags = QItemSelectionModel.Select | QItemSelectionModel.Columns
        for i, path in enumerate(u):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)
                smodel.select(model.index(i, 1), sflags)
                smodel.select(model.index(i, 2), sflags)

        @pyqtSlot(QItemSelection, QItemSelection)
        def uchanged(selected, deselected):
            enable = self.utree.selectionModel().hasSelection()
            for b in self.ubuttons:
                b.setEnabled(enable)
            for c in self.umenuitems:
                c.setEnabled(enable)
        smodel.selectionChanged.connect(uchanged)
        uchanged(None, None)

        paths = self.getSelectedPaths(self.rtree)
        oldmodel = self.rtree.model()
        self.rtree.setModel(PathsModel(r, self))
        self.rtree.resizeColumnToContents(0)
        self.rtree.resizeColumnToContents(1)
        if oldmodel:
            oldmodel.setParent(None)  # gc-ed

        model = self.rtree.model()
        smodel = self.rtree.selectionModel()
        for i, path in enumerate(r):
            if path in paths:
                smodel.select(model.index(i, 0), sflags)
                smodel.select(model.index(i, 1), sflags)
                smodel.select(model.index(i, 2), sflags)

        @pyqtSlot(QItemSelection, QItemSelection)
        def rchanged(selected, deselected):
            enable = self.rtree.selectionModel().hasSelection()
            for b in self.rbuttons:
                b.setEnabled(enable)
            for c in self.rmenuitems:
                c.setEnabled(enable)
            merge = len(self.repo.parents()) > 1
            for b in self.rmbuttons:
                b.setEnabled(enable and merge)
            for c in self.rmmenuitems:
                c.setEnabled(enable and merge)
        smodel.selectionChanged.connect(rchanged)
        rchanged(None, None)

        if u:
            txt = _('There are merge <b>conflicts</b> to be resolved')
        elif r:
            txt = _('All conflicts are resolved.')
        else:
            txt = _('There are no conflicting file merges.')
        self.stlabel.setText(u'<h2>' + txt + u'</h2>')