Show More
@@ -174,7 +174,9 b' def func(repo, subset, a, b):' | |||
|
174 | 174 | # functions |
|
175 | 175 | |
|
176 | 176 | def node(repo, subset, x): |
|
177 | # i18n: "id" is a keyword | |
|
177 | 178 | l = getargs(x, 1, 1, _("id requires one argument")) |
|
179 | # i18n: "id" is a keyword | |
|
178 | 180 | n = getstring(l[0], _("id requires a string")) |
|
179 | 181 | if len(n) == 40: |
|
180 | 182 | rn = repo[n].rev() |
@@ -183,10 +185,13 b' def node(repo, subset, x):' | |||
|
183 | 185 | return [r for r in subset if r == rn] |
|
184 | 186 | |
|
185 | 187 | def rev(repo, subset, x): |
|
188 | # i18n: "rev" is a keyword | |
|
186 | 189 | l = getargs(x, 1, 1, _("rev requires one argument")) |
|
187 | 190 | try: |
|
191 | # i18n: "rev" is a keyword | |
|
188 | 192 | l = int(getstring(l[0], _("rev requires a number"))) |
|
189 | 193 | except ValueError: |
|
194 | # i18n: "rev" is a keyword | |
|
190 | 195 | raise error.ParseError(_("rev expects a number")) |
|
191 | 196 | return [r for r in subset if r == l] |
|
192 | 197 | |
@@ -228,10 +233,13 b' def minrev(repo, subset, x):' | |||
|
228 | 233 | return [] |
|
229 | 234 | |
|
230 | 235 | def limit(repo, subset, x): |
|
236 | # i18n: "limit" is a keyword | |
|
231 | 237 | l = getargs(x, 2, 2, _("limit requires two arguments")) |
|
232 | 238 | try: |
|
239 | # i18n: "limit" is a keyword | |
|
233 | 240 | lim = int(getstring(l[1], _("limit requires a number"))) |
|
234 | 241 | except ValueError: |
|
242 | # i18n: "limit" is a keyword | |
|
235 | 243 | raise error.ParseError(_("limit expects a number")) |
|
236 | 244 | return getset(repo, subset, l[0])[:lim] |
|
237 | 245 | |
@@ -254,11 +262,13 b' def branch(repo, subset, x):' | |||
|
254 | 262 | return [r for r in subset if r in s or repo[r].branch() in b] |
|
255 | 263 | |
|
256 | 264 | def ancestor(repo, subset, x): |
|
265 | # i18n: "ancestor" is a keyword | |
|
257 | 266 | l = getargs(x, 2, 2, _("ancestor requires two arguments")) |
|
258 | 267 | r = range(len(repo)) |
|
259 | 268 | a = getset(repo, r, l[0]) |
|
260 | 269 | b = getset(repo, r, l[1]) |
|
261 | 270 | if len(a) != 1 or len(b) != 1: |
|
271 | # i18n: "ancestor" is a keyword | |
|
262 | 272 | raise error.ParseError(_("ancestor arguments must be single revisions")) |
|
263 | 273 | an = [repo[a[0]].ancestor(repo[b[0]]).rev()] |
|
264 | 274 | |
@@ -279,17 +289,20 b' def descendants(repo, subset, x):' | |||
|
279 | 289 | return [r for r in subset if r in s] |
|
280 | 290 | |
|
281 | 291 | def follow(repo, subset, x): |
|
292 | # i18n: "follow" is a keyword | |
|
282 | 293 | getargs(x, 0, 0, _("follow takes no arguments")) |
|
283 | 294 | p = repo['.'].rev() |
|
284 | 295 | s = set(repo.changelog.ancestors(p)) | set([p]) |
|
285 | 296 | return [r for r in subset if r in s] |
|
286 | 297 | |
|
287 | 298 | def date(repo, subset, x): |
|
299 | # i18n: "date" is a keyword | |
|
288 | 300 | ds = getstring(x, _("date requires a string")) |
|
289 | 301 | dm = util.matchdate(ds) |
|
290 | 302 | return [r for r in subset if dm(repo[r].date()[0])] |
|
291 | 303 | |
|
292 | 304 | def keyword(repo, subset, x): |
|
305 | # i18n: "keyword" is a keyword | |
|
293 | 306 | kw = getstring(x, _("keyword requires a string")).lower() |
|
294 | 307 | l = [] |
|
295 | 308 | for r in subset: |
@@ -301,6 +314,7 b' def keyword(repo, subset, x):' | |||
|
301 | 314 | |
|
302 | 315 | def grep(repo, subset, x): |
|
303 | 316 | try: |
|
317 | # i18n: "grep" is a keyword | |
|
304 | 318 | gr = re.compile(getstring(x, _("grep requires a string"))) |
|
305 | 319 | except re.error, e: |
|
306 | 320 | raise error.ParseError(_('invalid match pattern: %s') % e) |
@@ -314,10 +328,12 b' def grep(repo, subset, x):' | |||
|
314 | 328 | return l |
|
315 | 329 | |
|
316 | 330 | def author(repo, subset, x): |
|
331 | # i18n: "author" is a keyword | |
|
317 | 332 | n = getstring(x, _("author requires a string")).lower() |
|
318 | 333 | return [r for r in subset if n in repo[r].user().lower()] |
|
319 | 334 | |
|
320 | 335 | def hasfile(repo, subset, x): |
|
336 | # i18n: "file" is a keyword | |
|
321 | 337 | pat = getstring(x, _("file requires a pattern")) |
|
322 | 338 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
|
323 | 339 | s = [] |
@@ -329,6 +345,7 b' def hasfile(repo, subset, x):' | |||
|
329 | 345 | return s |
|
330 | 346 | |
|
331 | 347 | def contains(repo, subset, x): |
|
348 | # i18n: "contains" is a keyword | |
|
332 | 349 | pat = getstring(x, _("contains requires a pattern")) |
|
333 | 350 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
|
334 | 351 | s = [] |
@@ -373,27 +390,33 b' def checkstatus(repo, subset, pat, field' | |||
|
373 | 390 | return s |
|
374 | 391 | |
|
375 | 392 | def modifies(repo, subset, x): |
|
393 | # i18n: "modifies" is a keyword | |
|
376 | 394 | pat = getstring(x, _("modifies requires a pattern")) |
|
377 | 395 | return checkstatus(repo, subset, pat, 0) |
|
378 | 396 | |
|
379 | 397 | def adds(repo, subset, x): |
|
398 | # i18n: "adds" is a keyword | |
|
380 | 399 | pat = getstring(x, _("adds requires a pattern")) |
|
381 | 400 | return checkstatus(repo, subset, pat, 1) |
|
382 | 401 | |
|
383 | 402 | def removes(repo, subset, x): |
|
403 | # i18n: "removes" is a keyword | |
|
384 | 404 | pat = getstring(x, _("removes requires a pattern")) |
|
385 | 405 | return checkstatus(repo, subset, pat, 2) |
|
386 | 406 | |
|
387 | 407 | def merge(repo, subset, x): |
|
408 | # i18n: "merge" is a keyword | |
|
388 | 409 | getargs(x, 0, 0, _("merge takes no arguments")) |
|
389 | 410 | cl = repo.changelog |
|
390 | 411 | return [r for r in subset if cl.parentrevs(r)[1] != -1] |
|
391 | 412 | |
|
392 | 413 | def closed(repo, subset, x): |
|
414 | # i18n: "closed" is a keyword | |
|
393 | 415 | getargs(x, 0, 0, _("closed takes no arguments")) |
|
394 | 416 | return [r for r in subset if repo[r].extra().get('close')] |
|
395 | 417 | |
|
396 | 418 | def head(repo, subset, x): |
|
419 | # i18n: "head" is a keyword | |
|
397 | 420 | getargs(x, 0, 0, _("head takes no arguments")) |
|
398 | 421 | hs = set() |
|
399 | 422 | for b, ls in repo.branchmap().iteritems(): |
@@ -412,6 +435,7 b' def present(repo, subset, x):' | |||
|
412 | 435 | return [] |
|
413 | 436 | |
|
414 | 437 | def sort(repo, subset, x): |
|
438 | # i18n: "sort" is a keyword | |
|
415 | 439 | l = getargs(x, 1, 2, _("sort requires one or two arguments")) |
|
416 | 440 | keys = "rev" |
|
417 | 441 | if len(l) == 2: |
@@ -454,6 +478,7 b' def sort(repo, subset, x):' | |||
|
454 | 478 | return [e[-1] for e in l] |
|
455 | 479 | |
|
456 | 480 | def getall(repo, subset, x): |
|
481 | # i18n: "all" is a keyword | |
|
457 | 482 | getargs(x, 0, 0, _("all takes no arguments")) |
|
458 | 483 | return subset |
|
459 | 484 | |
@@ -469,7 +494,9 b' def roots(repo, subset, x):' | |||
|
469 | 494 | |
|
470 | 495 | def outgoing(repo, subset, x): |
|
471 | 496 | import hg # avoid start-up nasties |
|
497 | # i18n: "outgoing" is a keyword | |
|
472 | 498 | l = getargs(x, 0, 1, _("outgoing requires a repository path")) |
|
499 | # i18n: "outgoing" is a keyword | |
|
473 | 500 | dest = l and getstring(l[0], _("outgoing requires a repository path")) or '' |
|
474 | 501 | dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') |
|
475 | 502 | dest, branches = hg.parseurl(dest) |
@@ -485,10 +512,12 b' def outgoing(repo, subset, x):' | |||
|
485 | 512 | return [r for r in subset if r in o] |
|
486 | 513 | |
|
487 | 514 | def tag(repo, subset, x): |
|
515 | # i18n: "tag" is a keyword | |
|
488 | 516 | args = getargs(x, 0, 1, _("tag takes one or no arguments")) |
|
489 | 517 | cl = repo.changelog |
|
490 | 518 | if args: |
|
491 | 519 | tn = getstring(args[0], |
|
520 | # i18n: "tag" is a keyword | |
|
492 | 521 | _('the argument to tag must be a string')) |
|
493 | 522 | s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) |
|
494 | 523 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now