[PATCH 1 of 5 V2] revsets: record sort order keys

Yuya Nishihara yuya at tcha.org
Thu May 26 09:00:57 EDT 2016


On Wed, 25 May 2016 11:03:00 -0700, Martijn Pieters wrote:
> > On 25 May 2016, at 07:21, Yuya Nishihara <yuya at tcha.org> wrote:
> >   
> >>     def reverse(self):
> >>         if self._ascending is None:
> >>             self._list.reverse()
> >> +            self.sortorder = tuple(d[1:] if d[0] == '-' else '-' + d
> >> +                                   for d in self.sortorder)  
> > 
> > That's true only for unique items. sort(x, -author) != reverse(sort(x, author))
> > for example.  
> 
> No, it is not, but any *explicit sort orders* are maintained correctly.
> The difference then, is that any remaining relative order that wasn't
> explicitly sorted on is now reversed from the order you'd have gotten if
> you sorted the input on those reversed keys to start with.
> 
> If this really matters, we could re-apply the sort function with the new
> reversed sortorder. What do you think?

This patch seems to try hard to preserve raw sort key strings, but they
aren't exactly the same as what sort() would do. That made me feel keeping
raw sort keys wouldn't be nice.

Perhaps adding istopo() or something would be simpler.


More information about the Mercurial-devel mailing list