Mercurial > hg-stable
view .hgignore @ 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 | 964212780daf |
children | 1335bbfb066f |
line wrap: on
line source
syntax: glob *.elc *.tmp *.orig *.rej *~ *.mergebackup *.o *.so *.dll *.exe *.pyd *.pyc *.pyo *$py.class *.swp *.prof *.zip \#*\# .\#* tests/.coverage* tests/.testtimes* tests/.hypothesis tests/hypothesis-generated tests/annotated tests/exceptions tests/*.err tests/htmlcov build contrib/chg/chg contrib/hgsh/hgsh contrib/vagrant/.vagrant contrib/docker/debian-* contrib/docker/ubuntu-* dist packages doc/common.txt doc/*.[0-9] doc/*.[0-9].txt doc/*.[0-9].gendoc.txt doc/*.[0-9].{x,ht}ml MANIFEST MANIFEST.in patches mercurial/__modulepolicy__.py mercurial/__version__.py mercurial/hgpythonlib.h mercurial.egg-info .DS_Store tags cscope.* .idea/* .asv/* i18n/hg.pot locale/*/LC_MESSAGES/hg.mo hgext/__index__.py rust/target/ # Generated wheels wheelhouse/ syntax: regexp ^\.pc/ ^\.(pydev)?project # hackable windows distribution additions ^hg-python ^hg.py$