Commits

Yuya Nishihara committed 438966a

revert: inject RepoAgent in place of repo instance

  • Participants
  • Parent commits 863c61f

Comments (0)

Files changed (4)

tortoisehg/hgqt/chunks.py

         rev = self.ctx.rev()
         if rev is None:
             rev = self.ctx.p1().rev()
-        dlg = revert.RevertDialog(self.repo, filenames, rev, self)
+        dlg = revert.RevertDialog(self._repoagent, filenames, rev, self)
         dlg.exec_()
         dlg.deleteLater()
 

tortoisehg/hgqt/filectxactions.py

             return
         if rev is None:
             rev = repo[rev].p1().rev()
-        dlg = revert.RevertDialog(repo, fileSelection, rev,
+        repoagent = repo._pyqtobj  # TODO
+        dlg = revert.RevertDialog(repoagent, fileSelection, rev,
                                   parent=self.parent())
         dlg.exec_()
 

tortoisehg/hgqt/filedialogs.py

         fileSelection = [self.filerevmodel.graph.filename(rev)]
         if len(fileSelection) == 0:
             return
-        dlg = revert.RevertDialog(self.repo, fileSelection, rev, self)
+        dlg = revert.RevertDialog(self._repoagent, fileSelection, rev, self)
         if dlg:
             dlg.exec_()
             dlg.deleteLater()
         fileSelection = [self.filerevmodel.graph.filename(rev)]
         if len(fileSelection) == 0:
             return
-        dlg = revert.RevertDialog(self.repo, fileSelection, rev, self)
+        dlg = revert.RevertDialog(self._repoagent, fileSelection, rev, self)
         if dlg:
             dlg.exec_()
             dlg.deleteLater()

tortoisehg/hgqt/revert.py

 from tortoisehg.hgqt import cmdui, qtlib
 
 class RevertDialog(QDialog):
-    def __init__(self, repo, wfiles, rev, parent):
+    def __init__(self, repoagent, wfiles, rev, parent):
         super(RevertDialog, self).__init__(parent)
 
+        self._repoagent = repoagent
+        repo = repoagent.rawRepo()
         self.setWindowTitle(_('Revert - %s') % repo.displayname)
 
         f = self.windowFlags()
         self.setWindowFlags(f & ~Qt.WindowContextHelpButtonHint)
-        self.repo = repo
         self.wfiles = [repo.wjoin(wfile) for wfile in wfiles]
 
         self.setLayout(QVBoxLayout())
         self.layout().addWidget(bbox)
         self.bbox = bbox
 
+    @property
+    def repo(self):
+        return self._repoagent.rawRepo()
+
     def _addRevertTargetCombo(self, rev):
         if rev is None:
             raise ValueError('Cannot revert to working directory')