This is an archive of the discontinued Mercurial Phabricator instance.

context: extract partial nodeid lookup method to scmutil
ClosedPublic

Authored by martinvonz on Apr 8 2018, 12:03 PM.

Details

Summary

We will add another caller soon, and there's a non-obvious reason to
use the unfiltered repo that we don't want to copy across the code
base.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Apr 8 2018, 12:03 PM
yuja requested changes to this revision.Apr 9 2018, 9:57 AM
yuja added a subscriber: yuja.
yuja added inline comments.
mercurial/scmutil.py
439

We'll need to verify that the returned node is NOT hidden by e.g.
calling changelog.rev(node).

It's unlikely that callers expect this function may return a hidden
node.

This revision now requires changes to proceed.Apr 9 2018, 9:57 AM
martinvonz added inline comments.Apr 10 2018, 10:00 AM
mercurial/scmutil.py
439

Makes sense. Okay if I do that in a follow-up so the rest of the stack is not blocked by this (I will be away until Friday)?

yuja added inline comments.Apr 10 2018, 11:07 AM
mercurial/scmutil.py
439

I could add it if you're happy with the following change.

node = repo.unfiltered().changelog._partialmatch(prefix)
repo.changelog.rev(node)  # make sure node isn't filtered
return node
martinvonz added inline comments.Apr 10 2018, 11:35 AM
mercurial/scmutil.py
439

LGTM. Thank you!

This revision was automatically updated to reflect the committed changes.
yuja added a comment.Apr 10 2018, 12:03 PM

My bad. Added if node is None: return and pushed, thanks.