Commits

Yuya Nishihara committed 684fe8d

manifestmodel: extract stub function to test sameness of ctxs more precisely

  • Participants
  • Parent commits 3a63546
  • Branches stable

Comments (0)

Files changed (1)

tortoisehg/hgqt/manifestmodel.py

         """Change to the specified repository revision; None for working-dir"""
         roote = self._rootentry
         newroote = self._newRevNode(rev, prev)
-        if newroote.ctx == roote.ctx and newroote.pctx == roote.pctx:
+        if (_samectx(newroote.ctx, roote.ctx)
+            and _samectx(newroote.pctx, roote.pctx)):
             return
         self._populate = _populaterepo
         self._repopulateNodes(newroote=newroote)
 
     def setRawContext(self, ctx):
         """Change to the specified changectx in place of repository revision"""
-        if self._rootentry.ctx == ctx:
+        if _samectx(self._rootentry.ctx, ctx):
             return
         if _isreporev(ctx.rev()):
             repo = self._repoagent.rawRepo()
     # patchctx.rev() returns str, which isn't a valid repository revision
     return rev is None or isinstance(rev, int)
 
+def _samectx(ctx1, ctx2):
+    return ctx1 == ctx2
+
 # TODO: visual feedback to denote query type and error as in repofilter
 def _makematcher(repo, ctx, pat, changedonly):
     cwd = ''  # always relative to repo root