mercurial/revset.py
changeset 22811 c1fd827e1ae0
parent 22810 7f97cb12782f
child 22812 fcd12b310148
equal deleted inserted replaced
22810:7f97cb12782f 22811:c1fd827e1ae0
  2765         return self._ascending
  2765         return self._ascending
  2766 
  2766 
  2767     def isdescending(self):
  2767     def isdescending(self):
  2768         return not self._ascending
  2768         return not self._ascending
  2769 
  2769 
       
  2770     def first(self):
       
  2771         if self._ascending:
       
  2772             it = self.fastasc
       
  2773         else:
       
  2774             it = self.fastdesc
       
  2775         if it is None:
       
  2776             # we need to consume all and try again
       
  2777             for x in self._consumegen():
       
  2778                 pass
       
  2779             return self.first()
       
  2780         if self:
       
  2781             return it.next()
       
  2782         return None
       
  2783 
       
  2784     def last(self):
       
  2785         if self._ascending:
       
  2786             it = self.fastdesc
       
  2787         else:
       
  2788             it = self.fastasc
       
  2789         if it is None:
       
  2790             # we need to consume all and try again
       
  2791             for x in self._consumegen():
       
  2792                 pass
       
  2793             return self.first()
       
  2794         if self:
       
  2795             return it.next()
       
  2796         return None
       
  2797 
  2770 def spanset(repo, start=None, end=None):
  2798 def spanset(repo, start=None, end=None):
  2771     """factory function to dispatch between fullreposet and actual spanset
  2799     """factory function to dispatch between fullreposet and actual spanset
  2772 
  2800 
  2773     Feel free to update all spanset call sites and kill this function at some
  2801     Feel free to update all spanset call sites and kill this function at some
  2774     point.
  2802     point.