Mercurial > hg
comparison hgext/children.py @ 37357:7c8524efd847
children: support specifying revision by revset
Same reason as the previous patch.
Differential Revision: https://phab.mercurial-scm.org/D3085
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 05 Apr 2018 14:21:37 +0530 |
parents | 923362010525 |
children | c303d65d2e34 |
comparison
equal
deleted
inserted
replaced
37356:004e5c5821b2 | 37357:7c8524efd847 |
---|---|
20 from mercurial import ( | 20 from mercurial import ( |
21 cmdutil, | 21 cmdutil, |
22 logcmdutil, | 22 logcmdutil, |
23 pycompat, | 23 pycompat, |
24 registrar, | 24 registrar, |
25 scmutil, | |
25 ) | 26 ) |
26 | 27 |
27 templateopts = cmdutil.templateopts | 28 templateopts = cmdutil.templateopts |
28 | 29 |
29 cmdtable = {} | 30 cmdtable = {} |
57 See :hg:`help log` and :hg:`help revsets.children`. | 58 See :hg:`help log` and :hg:`help revsets.children`. |
58 | 59 |
59 """ | 60 """ |
60 opts = pycompat.byteskwargs(opts) | 61 opts = pycompat.byteskwargs(opts) |
61 rev = opts.get('rev') | 62 rev = opts.get('rev') |
63 ctx = scmutil.revsingle(repo, rev) | |
62 if file_: | 64 if file_: |
63 fctx = repo.filectx(file_, changeid=rev) | 65 fctx = repo.filectx(file_, changeid=ctx.rev()) |
64 childctxs = [fcctx.changectx() for fcctx in fctx.children()] | 66 childctxs = [fcctx.changectx() for fcctx in fctx.children()] |
65 else: | 67 else: |
66 ctx = repo[rev] | |
67 childctxs = ctx.children() | 68 childctxs = ctx.children() |
68 | 69 |
69 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) | 70 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) |
70 for cctx in childctxs: | 71 for cctx in childctxs: |
71 displayer.show(cctx) | 72 displayer.show(cctx) |