Page MenuHomePhabricator

hg-core: vendor Facebook's configparser crate
Needs RevisionPublic

Authored by indygreg on Dec 7 2019, 3:17 PM.


Group Reviewers

I added a number of files from
at commit b745b4421b8a8b130d2094b598cedf65655410ec. Files are unmodified from
their original versions. However, the paths are different: I've put all
files in the same directory. And I've removed some files we don't care about
(such as the C++ bindings and CMake rules). Notably missing is the
auto-generated and the Python script to generate it. We will
be able to generate this file automatically at build time (unlike
Facebook, which is constrained by not using Cargo or something).

The added files are not part of the hg-core project yet. Things will be
incorporated in future commits.

I haven't extensively audited the added code for functional correctness
and compatibility. But I did skim it and it seems to be a highly compatible
config parsing implementation. The most suspect code I found was around
config file path handling. There are references to "tupperware," which
appears to be a Facebook-specific thing. We will want to clean this up
at some point...

Diff Detail

rHG Mercurial
No Linters Available
No Unit Test Coverage

Event Timeline

indygreg created this revision.Dec 7 2019, 3:17 PM
quark added a subscriber: quark.Dec 7 2019, 6:06 PM
quark added inline comments.

You might want to revert D13875655 for the directory include feature, which has some test changes.

103–107 ↗(On Diff #18535)

You might want to follow this and remove the generated code.


You might want to remove these lines.


You might want to respect $PAGER. We ignored it to reduce support burden for mis-configuration.

Thank you for the feedback, @quark! You enlightened me to a few issues I missed during my very quick perusal.

I agree that doing away with the auto-generated feels like a better solution. I may revise this series yet again...

indygreg edited the summary of this revision. (Show Details)Dec 7 2019, 10:03 PM
indygreg updated this revision to Diff 18545.
Alphare added a subscriber: Alphare.Dec 9 2019, 6:38 AM
Alphare added inline comments.

Do we need bindings to C ? I don't see what the use-case is at this stage of the Rust development.


This function looks very Facebook specific, I don't think we want to include it at all.




Our current strategy is to assume config files to be in local encoding, not UTF-8. This makes sense from Facebook's perspective, but now as an upstream solution (see previous work on HgPath).


Is this hack still needed as of 1.34.2?


pest is really cool.

Alphare added inline comments.Dec 9 2019, 8:02 AM

My bad, it looks like you took care of it in a future patch.

durin42 added inline comments.Dec 11 2019, 12:44 PM

+1, I'm not sure what the use case for this would be in core.

pulkit added a subscriber: pulkit.Jan 13 2020, 11:37 AM

The C bindings need to be dropped in this patch. Queued the previous patches, many thanks for importing things!

@Alphare What's your current opinion on this diff, can you mark it accepted or request change appropriatly ?

baymax requested changes to this revision.Jul 15 2020, 12:20 PM

There seems to have been no activities on this Diff for the past 3 Months.

By policy, we are automatically moving it out of the need-review state.

Please, move it back to need-review without hesitation if this diff should still be discussed.


This revision now requires changes to proceed.Jul 15 2020, 12:20 PM