comparison mercurial/revset.py @ 22833:6f4109aa6877

fullreposet: use `sort` to enforce the order The `ascending` and `descending` methods are useless.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 07 Oct 2014 01:41:26 -0700
parents 2f1d2a42f040
children 9e316ea0bf52
comparison
equal deleted inserted replaced
22832:2f1d2a42f040 22833:6f4109aa6877
3018 elif not util.safehasattr(other, 'ascending'): 3018 elif not util.safehasattr(other, 'ascending'):
3019 # "other" is generatorset not a real smart set 3019 # "other" is generatorset not a real smart set
3020 # we fallback to the old way (sad kitten) 3020 # we fallback to the old way (sad kitten)
3021 return super(fullreposet, self).__and__(other) 3021 return super(fullreposet, self).__and__(other)
3022 3022
3023 # preserve order:
3024 #
3025 # this is probably useless and harmful in multiple cases but matches
3026 # the current behavior.
3027 if self.isascending(): 3023 if self.isascending():
3028 other.ascending() 3024 other.sort()
3029 else: 3025 else:
3030 other.descending() 3026 other.sort(reverse)
3031 return other 3027 return other
3032 3028
3033 # tell hggettext to extract docstrings from these functions: 3029 # tell hggettext to extract docstrings from these functions:
3034 i18nfunctions = symbols.values() 3030 i18nfunctions = symbols.values()