Show More
@@ -474,11 +474,14 b' def showparents(**args):' | |||||
474 | revision) nothing is shown.""" |
|
474 | revision) nothing is shown.""" | |
475 | repo = args['repo'] |
|
475 | repo = args['repo'] | |
476 | ctx = args['ctx'] |
|
476 | ctx = args['ctx'] | |
|
477 | pctxs = scmutil.meaningfulparents(repo, ctx) | |||
|
478 | prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str | |||
477 | parents = [[('rev', p.rev()), |
|
479 | parents = [[('rev', p.rev()), | |
478 | ('node', p.hex()), |
|
480 | ('node', p.hex()), | |
479 | ('phase', p.phasestr())] |
|
481 | ('phase', p.phasestr())] | |
480 |
for p in |
|
482 | for p in pctxs] | |
481 |
|
|
483 | f = _showlist('parent', parents, **args) | |
|
484 | return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}}) | |||
482 |
|
485 | |||
483 | def showphase(repo, ctx, templ, **args): |
|
486 | def showphase(repo, ctx, templ, **args): | |
484 | """:phase: String. The changeset phase name.""" |
|
487 | """:phase: String. The changeset phase name.""" |
@@ -3251,6 +3251,11 b' Test ifcontains function' | |||||
3251 | 1 did not add a |
|
3251 | 1 did not add a | |
3252 | 0 added a |
|
3252 | 0 added a | |
3253 |
|
3253 | |||
|
3254 | $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n' | |||
|
3255 | 2 is parent of 1 | |||
|
3256 | 1 | |||
|
3257 | 0 | |||
|
3258 | ||||
3254 | Test revset function |
|
3259 | Test revset function | |
3255 |
|
3260 | |||
3256 | $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n' |
|
3261 | $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n' | |
@@ -3293,13 +3298,18 b' Test revset function' | |||||
3293 | $ hg log --template '{revset("TIP"|lower)}\n' -l1 |
|
3298 | $ hg log --template '{revset("TIP"|lower)}\n' -l1 | |
3294 | 2 |
|
3299 | 2 | |
3295 |
|
3300 | |||
3296 | a list template is evaluated for each item of revset |
|
3301 | a list template is evaluated for each item of revset/parents | |
3297 |
|
3302 | |||
3298 | $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n' |
|
3303 | $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n' | |
3299 | 2 p: 1:bcc7ff960b8e |
|
3304 | 2 p: 1:bcc7ff960b8e | |
3300 | 1 p: 0:f7769ec2ab97 |
|
3305 | 1 p: 0:f7769ec2ab97 | |
3301 | 0 p: |
|
3306 | 0 p: | |
3302 |
|
3307 | |||
|
3308 | $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n' | |||
|
3309 | 2 p: 1:bcc7ff960b8e -1:000000000000 | |||
|
3310 | 1 p: 0:f7769ec2ab97 -1:000000000000 | |||
|
3311 | 0 p: -1:000000000000 -1:000000000000 | |||
|
3312 | ||||
3303 | therefore, 'revcache' should be recreated for each rev |
|
3313 | therefore, 'revcache' should be recreated for each rev | |
3304 |
|
3314 | |||
3305 | $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n' |
|
3315 | $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n' | |
@@ -3310,6 +3320,14 b' Test revset function' | |||||
3310 | 0 a |
|
3320 | 0 a | |
3311 | p |
|
3321 | p | |
3312 |
|
3322 | |||
|
3323 | $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n' | |||
|
3324 | 2 aa b | |||
|
3325 | p | |||
|
3326 | 1 | |||
|
3327 | p a | |||
|
3328 | 0 a | |||
|
3329 | p | |||
|
3330 | ||||
3313 | a revset item must be evaluated as an integer revision, not an offset from tip |
|
3331 | a revset item must be evaluated as an integer revision, not an offset from tip | |
3314 |
|
3332 | |||
3315 | $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n' |
|
3333 | $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n' |
General Comments 0
You need to be logged in to leave comments.
Login now