Patchwork D3085: children: support specifying revision by revset

login
register
mail settings
Submitter phabricator
Date April 4, 2018, 10:53 p.m.
Message ID <differential-rev-PHID-DREV-6v2mo7abfwdpdkiz4oca-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30300/
State Superseded
Headers show

Comments

phabricator - April 4, 2018, 10:53 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Same reason as the previous patch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3085

AFFECTED FILES
  hgext/children.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - April 5, 2018, 12:48 a.m.
indygreg added a comment.


  It would be nice to have tests for these changes to ensure we don't regress...
  
  But progress is progress.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3085

To: martinvonz, #hg-reviewers
Cc: indygreg, mercurial-devel
phabricator - April 5, 2018, 4:52 a.m.
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3085#49796, @indygreg wrote:
  
  > It would be nice to have tests for these changes to ensure we don't regress...
  >
  > But progress is progress.
  
  
  I spent about a minute or two trying to find a good test to update while writing https://phab.mercurial-scm.org/D3084, but there didn't even seem to be one for `hg heads <revision>`, so I was lazy. Thanks for making me check tests for `hg children`, because that was actually easy - I've just sent https://phab.mercurial-scm.org/D3120.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3085

To: martinvonz, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/hgext/children.py b/hgext/children.py
--- a/hgext/children.py
+++ b/hgext/children.py
@@ -22,6 +22,7 @@ 
     logcmdutil,
     pycompat,
     registrar,
+    scmutil,
 )
 
 templateopts = cmdutil.templateopts
@@ -59,11 +60,11 @@ 
     """
     opts = pycompat.byteskwargs(opts)
     rev = opts.get('rev')
+    ctx = scmutil.revsingle(repo, rev)
     if file_:
-        fctx = repo.filectx(file_, changeid=rev)
+        fctx = repo.filectx(file_, changeid=ctx.rev())
         childctxs = [fcctx.changectx() for fcctx in fctx.children()]
     else:
-        ctx = repo[rev]
         childctxs = ctx.children()
 
     displayer = logcmdutil.changesetdisplayer(ui, repo, opts)