def seek(self, rev):
        """Arrange the caches to help look up the given revision."""
        # TODO: binary search? Perhaps only when one or the other
        # stack is very large?
        if not self:
            return
        if type(rev) is not int:
            raise TypeError("rev must be int")
        past = self._past
        future = self._future
        if future:
            appender = past.append
            popper = future.pop
            future_start = future[-1][0]
            while future_start <= rev:
                appender(popper())
                if future:
                    future_start = future[-1][0]
                else:
                    break
        if past:
            popper = past.pop
            appender = future.append
            past_end = past[-1][0]
            while past_end > rev:
                appender(popper())
                if past:
                    past_end = past[-1][0]
                else:
                    break
Arrange the caches to help look up the given revision.