diff -r 453c8670566c -r 984e0412e82b mercurial/revset.py --- a/mercurial/revset.py Fri Apr 13 13:46:49 2012 +0200 +++ b/mercurial/revset.py Sat Apr 14 01:41:03 2012 +0200 @@ -950,6 +950,19 @@ fields.discard('summary') # We may want to match more than one field + # Not all fields take the same amount of time to be matched + # Sort the selected fields in order of increasing matching cost + fieldorder = ('phase', 'parents', 'user', 'date', 'branch', 'summary', + 'files', 'description', 'substate',) + def fieldkeyfunc(f): + try: + return fieldorder.index(f) + except ValueError: + # assume an unknown field is very costly + return len(fieldorder) + fields = list(fields) + fields.sort(key=fieldkeyfunc) + # Each field will be matched with its own "getfield" function # which will be added to the getfieldfuncs array of functions getfieldfuncs = []