##// END OF EJS Templates
revset: add a predicate for finding converted changesets...
Matt Harbison -
r17002:0eb52262 default
parent child Browse files
Show More
@@ -490,6 +490,27 b' def contains(repo, subset, x):'
490 break
490 break
491 return s
491 return s
492
492
493 def converted(repo, subset, x):
494 """``converted([id])``
495 Changesets converted from the given identifier in the old repository if
496 present, or all converted changesets if no identifier is specified.
497 """
498
499 # There is exactly no chance of resolving the revision, so do a simple
500 # string compare and hope for the best
501
502 # i18n: "converted" is a keyword
503 rev = None
504 l = getargs(x, 0, 1, _('converted takes one or no arguments'))
505 if l:
506 rev = getstring(l[0], _('converted requires a revision'))
507
508 def _matchvalue(r):
509 source = repo[r].extra().get('convert_revision', None)
510 return source is not None and (rev is None or source.startswith(rev))
511
512 return [r for r in subset if _matchvalue(r)]
513
493 def date(repo, subset, x):
514 def date(repo, subset, x):
494 """``date(interval)``
515 """``date(interval)``
495 Changesets within the interval, see :hg:`help dates`.
516 Changesets within the interval, see :hg:`help dates`.
@@ -1302,6 +1323,7 b' symbols = {'
1302 "children": children,
1323 "children": children,
1303 "closed": closed,
1324 "closed": closed,
1304 "contains": contains,
1325 "contains": contains,
1326 "converted": converted,
1305 "date": date,
1327 "date": date,
1306 "desc": desc,
1328 "desc": desc,
1307 "descendants": descendants,
1329 "descendants": descendants,
@@ -396,3 +396,52 b' test bogus URL'
396 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
396 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
397 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
397 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
398 [255]
398 [255]
399
400 test revset converted() lookup
401
402 $ hg --config convert.hg.saverev=True convert a c
403 initializing destination c repository
404 scanning source...
405 sorting...
406 converting...
407 4 a
408 3 b
409 2 c
410 1 d
411 0 e
412 $ echo f > c/f
413 $ hg -R c ci -d'0 0' -Amf
414 adding f
415 created new head
416 $ hg -R c log -r "converted(09d945a62ce6)"
417 changeset: 1:98c3dd46a874
418 user: test
419 date: Thu Jan 01 00:00:01 1970 +0000
420 summary: b
421
422 $ hg -R c log -r "converted()"
423 changeset: 0:31ed57b2037c
424 user: test
425 date: Thu Jan 01 00:00:00 1970 +0000
426 summary: a
427
428 changeset: 1:98c3dd46a874
429 user: test
430 date: Thu Jan 01 00:00:01 1970 +0000
431 summary: b
432
433 changeset: 2:3b9ca06ef716
434 user: test
435 date: Thu Jan 01 00:00:02 1970 +0000
436 summary: c
437
438 changeset: 3:4e0debd37cf2
439 user: test
440 date: Thu Jan 01 00:00:03 1970 +0000
441 summary: d
442
443 changeset: 4:9de3bc9349c5
444 user: test
445 date: Thu Jan 01 00:00:04 1970 +0000
446 summary: e
447
General Comments 0
You need to be logged in to leave comments. Login now