##// END OF EJS Templates
revset: add "diff" field to "matching" keyword...
Angel Ezquerra -
r17102:d9a046ae default
parent child Browse files
Show More
@@ -1058,8 +1058,11 b' def matching(repo, subset, x):'
1058 Valid fields are most regular revision fields and some special fields.
1058 Valid fields are most regular revision fields and some special fields.
1059
1059
1060 Regular revision fields are ``description``, ``author``, ``branch``,
1060 Regular revision fields are ``description``, ``author``, ``branch``,
1061 ``date``, ``files``, ``phase``, ``parents``, ``substate`` and ``user``.
1061 ``date``, ``files``, ``phase``, ``parents``, ``substate``, ``user``
1062 Note that ``author`` and ``user`` are synonyms.
1062 and ``diff``.
1063 Note that ``author`` and ``user`` are synonyms. ``diff`` refers to the
1064 contents of the revision. Two revisions matching their ``diff`` will
1065 also match their ``files``.
1063
1066
1064 Special fields are ``summary`` and ``metadata``:
1067 Special fields are ``summary`` and ``metadata``:
1065 ``summary`` matches the first line of the description.
1068 ``summary`` matches the first line of the description.
@@ -1079,12 +1082,18 b' def matching(repo, subset, x):'
1079 _("matching requires a string "
1082 _("matching requires a string "
1080 "as its second argument")).split()
1083 "as its second argument")).split()
1081
1084
1082 # Make sure that there are no repeated fields, and expand the
1085 # Make sure that there are no repeated fields,
1083 # 'special' 'metadata' field type
1086 # expand the 'special' 'metadata' field type
1087 # and check the 'files' whenever we check the 'diff'
1084 fields = []
1088 fields = []
1085 for field in fieldlist:
1089 for field in fieldlist:
1086 if field == 'metadata':
1090 if field == 'metadata':
1087 fields += ['user', 'description', 'date']
1091 fields += ['user', 'description', 'date']
1092 elif field == 'diff':
1093 # a revision matching the diff must also match the files
1094 # since matching the diff is very costly, make sure to
1095 # also match the files first
1096 fields += ['files', 'diff']
1088 else:
1097 else:
1089 if field == 'author':
1098 if field == 'author':
1090 field = 'user'
1099 field = 'user'
@@ -1098,7 +1107,7 b' def matching(repo, subset, x):'
1098 # Not all fields take the same amount of time to be matched
1107 # Not all fields take the same amount of time to be matched
1099 # Sort the selected fields in order of increasing matching cost
1108 # Sort the selected fields in order of increasing matching cost
1100 fieldorder = ['phase', 'parents', 'user', 'date', 'branch', 'summary',
1109 fieldorder = ['phase', 'parents', 'user', 'date', 'branch', 'summary',
1101 'files', 'description', 'substate']
1110 'files', 'description', 'substate', 'diff']
1102 def fieldkeyfunc(f):
1111 def fieldkeyfunc(f):
1103 try:
1112 try:
1104 return fieldorder.index(f)
1113 return fieldorder.index(f)
@@ -1121,6 +1130,7 b' def matching(repo, subset, x):'
1121 'phase': lambda r: repo[r].phase(),
1130 'phase': lambda r: repo[r].phase(),
1122 'substate': lambda r: repo[r].substate,
1131 'substate': lambda r: repo[r].substate,
1123 'summary': lambda r: repo[r].description().splitlines()[0],
1132 'summary': lambda r: repo[r].description().splitlines()[0],
1133 'diff': lambda r: list(repo[r].diff(git=True),)
1124 }
1134 }
1125 for info in fields:
1135 for info in fields:
1126 getfield = _funcs.get(info, None)
1136 getfield = _funcs.get(info, None)
General Comments 0
You need to be logged in to leave comments. Login now