120 predicate = registrar.filesetpredicate(symbols) |
120 predicate = registrar.filesetpredicate(symbols) |
121 |
121 |
122 |
122 |
123 @predicate(b'modified()', callstatus=True, weight=_WEIGHT_STATUS) |
123 @predicate(b'modified()', callstatus=True, weight=_WEIGHT_STATUS) |
124 def modified(mctx, x): |
124 def modified(mctx, x): |
125 """File that is modified according to :hg:`status`. |
125 """File that is modified according to :hg:`status`.""" |
126 """ |
|
127 # i18n: "modified" is a keyword |
126 # i18n: "modified" is a keyword |
128 getargs(x, 0, 0, _(b"modified takes no arguments")) |
127 getargs(x, 0, 0, _(b"modified takes no arguments")) |
129 s = set(mctx.status().modified) |
128 s = set(mctx.status().modified) |
130 return mctx.predicate(s.__contains__, predrepr=b'modified') |
129 return mctx.predicate(s.__contains__, predrepr=b'modified') |
131 |
130 |
132 |
131 |
133 @predicate(b'added()', callstatus=True, weight=_WEIGHT_STATUS) |
132 @predicate(b'added()', callstatus=True, weight=_WEIGHT_STATUS) |
134 def added(mctx, x): |
133 def added(mctx, x): |
135 """File that is added according to :hg:`status`. |
134 """File that is added according to :hg:`status`.""" |
136 """ |
|
137 # i18n: "added" is a keyword |
135 # i18n: "added" is a keyword |
138 getargs(x, 0, 0, _(b"added takes no arguments")) |
136 getargs(x, 0, 0, _(b"added takes no arguments")) |
139 s = set(mctx.status().added) |
137 s = set(mctx.status().added) |
140 return mctx.predicate(s.__contains__, predrepr=b'added') |
138 return mctx.predicate(s.__contains__, predrepr=b'added') |
141 |
139 |
142 |
140 |
143 @predicate(b'removed()', callstatus=True, weight=_WEIGHT_STATUS) |
141 @predicate(b'removed()', callstatus=True, weight=_WEIGHT_STATUS) |
144 def removed(mctx, x): |
142 def removed(mctx, x): |
145 """File that is removed according to :hg:`status`. |
143 """File that is removed according to :hg:`status`.""" |
146 """ |
|
147 # i18n: "removed" is a keyword |
144 # i18n: "removed" is a keyword |
148 getargs(x, 0, 0, _(b"removed takes no arguments")) |
145 getargs(x, 0, 0, _(b"removed takes no arguments")) |
149 s = set(mctx.status().removed) |
146 s = set(mctx.status().removed) |
150 return mctx.predicate(s.__contains__, predrepr=b'removed') |
147 return mctx.predicate(s.__contains__, predrepr=b'removed') |
151 |
148 |
152 |
149 |
153 @predicate(b'deleted()', callstatus=True, weight=_WEIGHT_STATUS) |
150 @predicate(b'deleted()', callstatus=True, weight=_WEIGHT_STATUS) |
154 def deleted(mctx, x): |
151 def deleted(mctx, x): |
155 """Alias for ``missing()``. |
152 """Alias for ``missing()``.""" |
156 """ |
|
157 # i18n: "deleted" is a keyword |
153 # i18n: "deleted" is a keyword |
158 getargs(x, 0, 0, _(b"deleted takes no arguments")) |
154 getargs(x, 0, 0, _(b"deleted takes no arguments")) |
159 s = set(mctx.status().deleted) |
155 s = set(mctx.status().deleted) |
160 return mctx.predicate(s.__contains__, predrepr=b'deleted') |
156 return mctx.predicate(s.__contains__, predrepr=b'deleted') |
161 |
157 |
162 |
158 |
163 @predicate(b'missing()', callstatus=True, weight=_WEIGHT_STATUS) |
159 @predicate(b'missing()', callstatus=True, weight=_WEIGHT_STATUS) |
164 def missing(mctx, x): |
160 def missing(mctx, x): |
165 """File that is missing according to :hg:`status`. |
161 """File that is missing according to :hg:`status`.""" |
166 """ |
|
167 # i18n: "missing" is a keyword |
162 # i18n: "missing" is a keyword |
168 getargs(x, 0, 0, _(b"missing takes no arguments")) |
163 getargs(x, 0, 0, _(b"missing takes no arguments")) |
169 s = set(mctx.status().deleted) |
164 s = set(mctx.status().deleted) |
170 return mctx.predicate(s.__contains__, predrepr=b'deleted') |
165 return mctx.predicate(s.__contains__, predrepr=b'deleted') |
171 |
166 |
188 return mctx.predicate(s.__contains__, predrepr=b'ignored') |
183 return mctx.predicate(s.__contains__, predrepr=b'ignored') |
189 |
184 |
190 |
185 |
191 @predicate(b'clean()', callstatus=True, weight=_WEIGHT_STATUS) |
186 @predicate(b'clean()', callstatus=True, weight=_WEIGHT_STATUS) |
192 def clean(mctx, x): |
187 def clean(mctx, x): |
193 """File that is clean according to :hg:`status`. |
188 """File that is clean according to :hg:`status`.""" |
194 """ |
|
195 # i18n: "clean" is a keyword |
189 # i18n: "clean" is a keyword |
196 getargs(x, 0, 0, _(b"clean takes no arguments")) |
190 getargs(x, 0, 0, _(b"clean takes no arguments")) |
197 s = set(mctx.status().clean) |
191 s = set(mctx.status().clean) |
198 return mctx.predicate(s.__contains__, predrepr=b'clean') |
192 return mctx.predicate(s.__contains__, predrepr=b'clean') |
199 |
193 |
206 return mctx.predicate(mctx.ctx.__contains__, predrepr=b'tracked') |
200 return mctx.predicate(mctx.ctx.__contains__, predrepr=b'tracked') |
207 |
201 |
208 |
202 |
209 @predicate(b'binary()', weight=_WEIGHT_READ_CONTENTS) |
203 @predicate(b'binary()', weight=_WEIGHT_READ_CONTENTS) |
210 def binary(mctx, x): |
204 def binary(mctx, x): |
211 """File that appears to be binary (contains NUL bytes). |
205 """File that appears to be binary (contains NUL bytes).""" |
212 """ |
|
213 # i18n: "binary" is a keyword |
206 # i18n: "binary" is a keyword |
214 getargs(x, 0, 0, _(b"binary takes no arguments")) |
207 getargs(x, 0, 0, _(b"binary takes no arguments")) |
215 return mctx.fpredicate( |
208 return mctx.fpredicate( |
216 lambda fctx: fctx.isbinary(), predrepr=b'binary', cache=True |
209 lambda fctx: fctx.isbinary(), predrepr=b'binary', cache=True |
217 ) |
210 ) |
218 |
211 |
219 |
212 |
220 @predicate(b'exec()') |
213 @predicate(b'exec()') |
221 def exec_(mctx, x): |
214 def exec_(mctx, x): |
222 """File that is marked as executable. |
215 """File that is marked as executable.""" |
223 """ |
|
224 # i18n: "exec" is a keyword |
216 # i18n: "exec" is a keyword |
225 getargs(x, 0, 0, _(b"exec takes no arguments")) |
217 getargs(x, 0, 0, _(b"exec takes no arguments")) |
226 ctx = mctx.ctx |
218 ctx = mctx.ctx |
227 return mctx.predicate(lambda f: ctx.flags(f) == b'x', predrepr=b'exec') |
219 return mctx.predicate(lambda f: ctx.flags(f) == b'x', predrepr=b'exec') |
228 |
220 |
229 |
221 |
230 @predicate(b'symlink()') |
222 @predicate(b'symlink()') |
231 def symlink(mctx, x): |
223 def symlink(mctx, x): |
232 """File that is marked as a symlink. |
224 """File that is marked as a symlink.""" |
233 """ |
|
234 # i18n: "symlink" is a keyword |
225 # i18n: "symlink" is a keyword |
235 getargs(x, 0, 0, _(b"symlink takes no arguments")) |
226 getargs(x, 0, 0, _(b"symlink takes no arguments")) |
236 ctx = mctx.ctx |
227 ctx = mctx.ctx |
237 return mctx.predicate(lambda f: ctx.flags(f) == b'l', predrepr=b'symlink') |
228 return mctx.predicate(lambda f: ctx.flags(f) == b'l', predrepr=b'symlink') |
238 |
229 |
239 |
230 |
240 @predicate(b'resolved()', weight=_WEIGHT_STATUS) |
231 @predicate(b'resolved()', weight=_WEIGHT_STATUS) |
241 def resolved(mctx, x): |
232 def resolved(mctx, x): |
242 """File that is marked resolved according to :hg:`resolve -l`. |
233 """File that is marked resolved according to :hg:`resolve -l`.""" |
243 """ |
|
244 # i18n: "resolved" is a keyword |
234 # i18n: "resolved" is a keyword |
245 getargs(x, 0, 0, _(b"resolved takes no arguments")) |
235 getargs(x, 0, 0, _(b"resolved takes no arguments")) |
246 if mctx.ctx.rev() is not None: |
236 if mctx.ctx.rev() is not None: |
247 return mctx.never() |
237 return mctx.never() |
248 ms = mergestatemod.mergestate.read(mctx.ctx.repo()) |
238 ms = mergestatemod.mergestate.read(mctx.ctx.repo()) |