Mercurial > hg
view tests/test-install.t @ 35098:66c5a8cf2868
lfs: import the Facebook git-lfs client extension
The purpose of this is the same as the built-in largefiles extension- to handle
huge files outside of the normal storage system, generally to keep the amount of
data cloned to a lower amount. There are several benefits of implementing the
git-lfs protocol, instead of using the largefiles extension:
- Bitbucket and Github support (and probably wider support in 3rd party
hosting sites in general). [1][2]
- The number of hg internals monkey patched are several orders of magnitude
lower, so it will be easier to reason about and maintain. Future commands
will likely just work, without requiring various wrappers.
- The "standin" files are only written to the filelog, not the disk. That
should avoid weird edge cases where the largefile and standin files get out
of sync. [3] It also avoids the occasional printing of the "hidden" standin
file in various messages.
- Filesets like size() will work, even if the file isn't present. (It always
says 41 bytes for largefiles, whether present or not.)
The only place that I see where largefiles comes out on top is that it works
with `hg serve` for simple sharing, without external infrastructure. Getting
lfs-test-server working was a hassle, and took awhile to figure out. Maybe we
can do something to make it work in the future.
Long term, I expect that this will be highly preferred over largefiles. But if
we are to recommend this to largefile users, there are some UI issues to
bikeshed. Until they are resolved, I've marked this experimental, and am not
putting a pointer to this in the largefiles help. The (non exhaustive) list of
issues I've seen so far are:
- It isn't sufficient to just enable the largefiles extension- you have to
explicitly add a file with --large before it will pay attention to the
configured sizes and patterns on future adds. The justification being that
once you use it, you're stuck with it. I've seen people confused by this,
and haven't liked it myself. But it's also saved me a few times. Should we
do something like have a specific enabling config setting that must be set
in the local repo config, so that enabling this extension in the user or
system hgrc doesn't silently start storing lfs files?
- The largefiles extension adds a repo requirement when the first largefile is
committed, so that the extension must always be enabled in the future. This
extension is not doing that, and since I only enabled it locally to avoid
infecting other repos, I got a cryptic error about missing flag processors
when I cloned. Is there no repo requirement due to shallow/narrow clone
considerations (or other future advanced things)?
- In the (small amount of) reading I've done about the git implementation, it
seems that the files and sizes are stored in a tracked .gitattributes file.
I think a tracked file for this would be extremely useful for consistency
across developers, but this kind of touches on the tracked hgrc file
proposal a few months back.
- The git client can specify file patterns, not just sizes.
- The largefiles extension has a cache directory in the local repo, but also a
system wide one. We should probably implement a system wide cache too, so
that multiple clones don't have to refetch the files from the server.
- Jun mentioned other missing features, like SSH authentication, gc, etc.
The code corresponds to c0492b73c7ef in hg-experimental. [4] The only tweaks
are to load the extension in the tests with 'lfs=' instead of
'lfs=$TESTDIR/../hgext3rd/lfs', change the import in the *.py test to hgext
(from hgext3rd), add the 'testedwith' declaration, and mark it experimental for
now. The infinite-push, p4fastimport, and remotefilelog tests were left behind.
The devel-warnings for unregistered config options are not corrected yet, nor
are the import check warnings.
[1] https://www.mercurial-scm.org/pipermail/mercurial/2017-November/050699.html
[2] https://bitbucket.org/site/master/issues/3843/largefiles-support-bb-3903
[3] https://bz.mercurial-scm.org/show_bug.cgi?id=5738
[4] https://bitbucket.org/facebook/hg-experimental
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 14 Nov 2017 00:06:23 -0500 |
parents | ada8a19672ab |
children | 8251c4c4abdc |
line wrap: on
line source
hg debuginstall $ hg debuginstall checking encoding (ascii)... checking Python executable (*) (glob) checking Python version (2.*) (glob) checking Python lib (*lib*)... (glob) checking Python security support (*) (glob) TLS 1.2 not supported by Python install; network connections lack modern security (?) SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking registered compression engines (*zlib*) (glob) checking available compression engines (*zlib*) (glob) checking available compression engines for wire protocol (*zlib*) (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob) checking commit editor... (* -c "import sys; sys.exit(0)") (glob) checking username (test) no problems detected hg debuginstall JSON $ hg debuginstall -Tjson | sed 's|\\\\|\\|g' [ { "compengines": ["bz2", "bz2truncated", "none", "zlib"*], (glob) "compenginesavail": ["bz2", "bz2truncated", "none", "zlib"*], (glob) "compenginesserver": [*"zlib"*], (glob) "defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob) "defaulttemplateerror": null, "defaulttemplatenotfound": "default", "editor": "* -c \"import sys; sys.exit(0)\"", (glob) "editornotfound": false, "encoding": "ascii", "encodingerror": null, "extensionserror": null, (no-pure !) "hgmodulepolicy": "*", (glob) "hgmodules": "*mercurial", (glob) "hgver": "*", (glob) "hgverextra": "*", (glob) "problems": 0, "pythonexe": "*", (glob) "pythonlib": "*", (glob) "pythonsecurity": [*], (glob) "pythonver": "*.*.*", (glob) "templatedirs": "*mercurial?templates", (glob) "username": "test", "usernameerror": null, "vinotfound": false } ] hg debuginstall with no username $ HGUSER= hg debuginstall checking encoding (ascii)... checking Python executable (*) (glob) checking Python version (2.*) (glob) checking Python lib (*lib*)... (glob) checking Python security support (*) (glob) TLS 1.2 not supported by Python install; network connections lack modern security (?) SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking registered compression engines (*zlib*) (glob) checking available compression engines (*zlib*) (glob) checking available compression engines for wire protocol (*zlib*) (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob) checking commit editor... (* -c "import sys; sys.exit(0)") (glob) checking username... no username supplied (specify a username in your configuration file) 1 problems detected, please check your install! [1] hg debuginstall with invalid encoding $ HGENCODING=invalidenc hg debuginstall | grep encoding checking encoding (invalidenc)... unknown encoding: invalidenc exception message in JSON $ HGENCODING=invalidenc HGUSER= hg debuginstall -Tjson | grep error "defaulttemplateerror": null, "encodingerror": "unknown encoding: invalidenc", "extensionserror": null, (no-pure !) "usernameerror": "no username supplied", path variables are expanded (~ is the same as $TESTTMP) $ mkdir tools $ touch tools/testeditor.exe #if execbit $ chmod 755 tools/testeditor.exe #endif $ hg debuginstall --config ui.editor=~/tools/testeditor.exe checking encoding (ascii)... checking Python executable (*) (glob) checking Python version (*) (glob) checking Python lib (*lib*)... (glob) checking Python security support (*) (glob) TLS 1.2 not supported by Python install; network connections lack modern security (?) SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) checking installed modules (*mercurial)... (glob) checking registered compression engines (*zlib*) (glob) checking available compression engines (*zlib*) (glob) checking available compression engines for wire protocol (*zlib*) (glob) checking templates (*mercurial?templates)... (glob) checking default template (*mercurial?templates?map-cmdline.default) (glob) checking commit editor... (* -c "import sys; sys.exit(0)") (glob) checking username (test) no problems detected #if test-repo $ . "$TESTDIR/helpers-testrepo.sh" $ cat >> wixxml.py << EOF > import os, subprocess, sys > import xml.etree.ElementTree as ET > > # MSYS mangles the path if it expands $TESTDIR > testdir = os.environ['TESTDIR'] > ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'} > > def directory(node, relpath): > '''generator of files in the xml node, rooted at relpath''' > dirs = node.findall('./{%(wix)s}Directory' % ns) > > for d in dirs: > for subfile in directory(d, relpath + d.attrib['Name'] + '/'): > yield subfile > > files = node.findall('./{%(wix)s}Component/{%(wix)s}File' % ns) > > for f in files: > yield relpath + f.attrib['Name'] > > def hgdirectory(relpath): > '''generator of tracked files, rooted at relpath''' > hgdir = "%s/../mercurial" % (testdir) > args = ['hg', '--cwd', hgdir, 'files', relpath] > proc = subprocess.Popen(args, stdout=subprocess.PIPE, > stderr=subprocess.PIPE) > output = proc.communicate()[0] > > slash = '/' > for line in output.splitlines(): > if os.name == 'nt': > yield line.replace(os.sep, slash) > else: > yield line > > tracked = [f for f in hgdirectory(sys.argv[1])] > > xml = ET.parse("%s/../contrib/wix/%s.wxs" % (testdir, sys.argv[1])) > root = xml.getroot() > dir = root.find('.//{%(wix)s}DirectoryRef' % ns) > > installed = [f for f in directory(dir, '')] > > print('Not installed:') > for f in sorted(set(tracked) - set(installed)): > print(' %s' % f) > > print('Not tracked:') > for f in sorted(set(installed) - set(tracked)): > print(' %s' % f) > EOF $ ( testrepohgenv; $PYTHON wixxml.py help ) Not installed: help/common.txt help/hg-ssh.8.txt help/hg.1.txt help/hgignore.5.txt help/hgrc.5.txt Not tracked: $ ( testrepohgenv; $PYTHON wixxml.py templates ) Not installed: Not tracked: #endif #if virtualenv Verify that Mercurial is installable with pip. Note that this MUST be the last test in this file, because we do some nasty things to the shell environment in order to make the virtualenv work reliably. $ cd $TESTTMP Note: --no-site-packages is deprecated, but some places have an ancient virtualenv from their linux distro or similar and it's not yet the default for them. $ unset PYTHONPATH $ $PYTHON -m virtualenv --no-site-packages --never-download installenv >> pip.log Note: we use this weird path to run pip and hg to avoid platform differences, since it's bin on most platforms but Scripts on Windows. $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log $ ./installenv/*/hg debuginstall || cat pip.log checking encoding (ascii)... checking Python executable (*) (glob) checking Python version (2.*) (glob) checking Python lib (*)... (glob) checking Python security support (*) (glob) TLS 1.2 not supported by Python install; network connections lack modern security (?) SNI not supported by Python install; may have connectivity issues with some servers (?) checking Mercurial version (*) (glob) checking Mercurial custom build (*) (glob) checking module policy (*) (glob) checking installed modules (*/mercurial)... (glob) checking registered compression engines (*) (glob) checking available compression engines (*) (glob) checking available compression engines for wire protocol (*) (glob) checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) checking commit editor... (*) (glob) checking username (test) no problems detected #endif