Mercurial > hg
view .clang-format @ 35665:1ad1e59b405e
lfs: control tracked file selection via a tracked file
Since the lfs tracking policy can dramatically affect the repository, it makes
more sense to have the policy file checked in, than to rely on all developers
configuring their .hgrc properly. The inspiration for this is the .hgeol file.
The configuration lives under '[track]', so that other things can be added in
the future. Eventually, the config option should be limited to `convert` only.
If the file can't be parsed for any reason (including unrecognized elements of
the minifileset language), the commit will abort until the problem is corrected.
This seems more useful than the warning that hgeol emits, and has no effect on
reading the data, so there's no compatibility concerns.
My initial thought was to read the file and change each "key = value" line into
"((key) & (value))", so that each line could be ORed together, and make a single
pass at compiling. Unfortunately, that prevents exclusions if there's a
catchall rule. Consider what happens to a large *.c file here:
[track]
**.c = none()
** = size('>1MB')
# ((**.c) & (none())) | ((**) & (size('>1MB'))) => anything > 1MB
I also thought about having separate [include] and [exclude] sections. But that
just seems to open things up to user mistakes. Consider:
[include]
**.zip = all()
**.php = size('>10MB')
[exclude]
**.zip = all() # Who wins?
**.php = none() # Effectively 'all()' (i.e. nothing excluded), or >10MB ?
Therefore, it just compiles each key and value separately, and walks until the
key matches something. I'm not sure how to enforce just file patterns on LHS
without leaking knowledge about the minifileset here. That means this will
allow odd looking lines like this:
[track]
**.c | **.txt = none()
But that's also fewer lines to compile, so slightly more efficient? Some things
like 'none()' won't work as expected on LHS though, because that won't match, so
that line is skipped. For now, these quirks are not mentioned in the
documentation.
Jun previously expressed concern about efficiency when scaling to large repos,
so I tried avoiding 'repo[None]'. (localrepo.commit() gets repo[None] already,
but doesn't tie it to the workingcommitctx used here.) Therefore, I looked at
the passed context for 'AMR' status. But that doesn't help with the normal case
where the policy file is tracked, but clean. That requires looking up p1() to
read the file. I don't see any way to get the content of one file without first
creating the full parent context.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 14 Jan 2018 18:12:51 -0500 |
parents | e33381d95930 |
children | d0a3fa849cb8 |
line wrap: on
line source
BasedOnStyle: LLVM IndentWidth: 8 UseTab: ForIndentation BreakBeforeBraces: Linux AllowShortIfStatementsOnASingleLine: false IndentCaseLabels: false AllowShortBlocksOnASingleLine: false AllowShortFunctionsOnASingleLine: false