| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>lfs</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="lfs"> |
| 12 |
<span id="ext-lfs"></span> |
| 13 |
<h1 class="title">lfs</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#description" id="toc-entry-1">Description</a></li> |
| 19 |
<li><a class="reference internal" href="#commands" id="toc-entry-2">Commands</a></li> |
| 20 |
</ul> |
| 21 |
</div> |
| 22 |
<p>lfs - large file support (EXPERIMENTAL)</p> |
| 23 |
<div class="section" id="description"> |
| 24 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 25 |
<p>This extension allows large files to be tracked outside of the normal |
| 26 |
repository storage and stored on a centralized server, similar to the |
| 27 |
<tt class="docutils literal">largefiles</tt> extension. The <tt class="docutils literal"><span class="pre">git-lfs</span></tt> protocol is used when |
| 28 |
communicating with the server, so existing git infrastructure can be |
| 29 |
harnessed. Even though the files are stored outside of the repository, |
| 30 |
they are still integrity checked in the same manner as normal files.</p> |
| 31 |
<p>The files stored outside of the repository are downloaded on demand, |
| 32 |
which reduces the time to clone, and possibly the local disk usage. |
| 33 |
This changes fundamental workflows in a DVCS, so careful thought |
| 34 |
should be given before deploying it. <a class="reference external" href="hg-convert.html"><tt class="docutils literal">hg convert</tt></a> can be used to |
| 35 |
convert LFS repositories to normal repositories that no longer |
| 36 |
require this extension, and do so without changing the commit hashes. |
| 37 |
This allows the extension to be disabled if the centralized workflow |
| 38 |
becomes burdensome. However, the pre and post convert clones will |
| 39 |
not be able to communicate with each other unless the extension is |
| 40 |
enabled on both.</p> |
| 41 |
<p>To start a new repository, or to add LFS files to an existing one, just |
| 42 |
create an <tt class="docutils literal">.hglfs</tt> file as described below in the root directory of |
| 43 |
the repository. Typically, this file should be put under version |
| 44 |
control, so that the settings will propagate to other repositories with |
| 45 |
push and pull. During any commit, Mercurial will consult this file to |
| 46 |
determine if an added or modified file should be stored externally. The |
| 47 |
type of storage depends on the characteristics of the file at each |
| 48 |
commit. A file that is near a size threshold may switch back and forth |
| 49 |
between LFS and normal storage, as needed.</p> |
| 50 |
<p>Alternately, both normal repositories and largefile controlled |
| 51 |
repositories can be converted to LFS by using <a class="reference external" href="hg-convert.html"><tt class="docutils literal">hg convert</tt></a> and the |
| 52 |
<tt class="docutils literal">lfs.track</tt> config option described below. The <tt class="docutils literal">.hglfs</tt> file |
| 53 |
should then be created and added, to control subsequent LFS selection. |
| 54 |
The hashes are also unchanged in this case. The LFS and non-LFS |
| 55 |
repositories can be distinguished because the LFS repository will |
| 56 |
abort any command if this extension is disabled.</p> |
| 57 |
<p>Committed LFS files are held locally, until the repository is pushed. |
| 58 |
Prior to pushing the normal repository data, the LFS files that are |
| 59 |
tracked by the outgoing commits are automatically uploaded to the |
| 60 |
configured central server. No LFS files are transferred on |
| 61 |
<a class="reference external" href="hg-pull.html"><tt class="docutils literal">hg pull</tt></a> or <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a>. Instead, the files are downloaded on |
| 62 |
demand as they need to be read, if a cached copy cannot be found |
| 63 |
locally. Both committing and downloading an LFS file will link the |
| 64 |
file to a usercache, to speed up future access. See the <cite>usercache</cite> |
| 65 |
config setting described below.</p> |
| 66 |
<p>The extension reads its configuration from a versioned <tt class="docutils literal">.hglfs</tt> |
| 67 |
configuration file found in the root of the working directory. The |
| 68 |
<tt class="docutils literal">.hglfs</tt> file uses the same syntax as all other Mercurial |
| 69 |
configuration files. It uses a single section, <tt class="docutils literal">[track]</tt>.</p> |
| 70 |
<p>The <tt class="docutils literal">[track]</tt> section specifies which files are stored as LFS (or |
| 71 |
not). Each line is keyed by a file pattern, with a predicate value. |
| 72 |
The first file pattern match is used, so put more specific patterns |
| 73 |
first. The available predicates are <tt class="docutils literal">all()</tt>, <tt class="docutils literal">none()</tt>, and |
| 74 |
<tt class="docutils literal">size()</tt>. See "hg help filesets.size" for the latter.</p> |
| 75 |
<p>Example versioned <tt class="docutils literal">.hglfs</tt> file:</p> |
| 76 |
<pre class="literal-block"> |
| 77 |
[track] |
| 78 |
# No Makefile or python file, anywhere, will be LFS |
| 79 |
**Makefile = none() |
| 80 |
**.py = none() |
| 81 |
|
| 82 |
**.zip = all() |
| 83 |
**.exe = size(">1MB") |
| 84 |
|
| 85 |
# Catchall for everything not matched above |
| 86 |
** = size(">10MB") |
| 87 |
</pre> |
| 88 |
<p>Configs:</p> |
| 89 |
<pre class="literal-block"> |
| 90 |
[lfs] |
| 91 |
# Remote endpoint. Multiple protocols are supported: |
| 92 |
# - http(s)://user:pass@example.com/path |
| 93 |
# git-lfs endpoint |
| 94 |
# - file:///tmp/path |
| 95 |
# local filesystem, usually for testing |
| 96 |
# if unset, lfs will assume the remote repository also handles blob storage |
| 97 |
# for http(s) URLs. Otherwise, lfs will prompt to set this when it must |
| 98 |
# use this value. |
| 99 |
# (default: unset) |
| 100 |
url = https://example.com/repo.git/info/lfs |
| 101 |
|
| 102 |
# Which files to track in LFS. Path tests are "**.extname" for file |
| 103 |
# extensions, and "path:under/some/directory" for path prefix. Both |
| 104 |
# are relative to the repository root. |
| 105 |
# File size can be tested with the "size()" fileset, and tests can be |
| 106 |
# joined with fileset operators. (See "hg help filesets.operators".) |
| 107 |
# |
| 108 |
# Some examples: |
| 109 |
# - all() # everything |
| 110 |
# - none() # nothing |
| 111 |
# - size(">20MB") # larger than 20MB |
| 112 |
# - !**.txt # anything not a *.txt file |
| 113 |
# - **.zip | **.tar.gz | **.7z # some types of compressed files |
| 114 |
# - path:bin # files under "bin" in the project root |
| 115 |
# - (**.php & size(">2MB")) | (**.js & size(">5MB")) | **.tar.gz |
| 116 |
# | (path:bin & !path:/bin/README) | size(">1GB") |
| 117 |
# (default: none()) |
| 118 |
# |
| 119 |
# This is ignored if there is a tracked '.hglfs' file, and this setting |
| 120 |
# will eventually be deprecated and removed. |
| 121 |
track = size(">10M") |
| 122 |
|
| 123 |
# how many times to retry before giving up on transferring an object |
| 124 |
retry = 5 |
| 125 |
|
| 126 |
# the local directory to store lfs files for sharing across local clones. |
| 127 |
# If not set, the cache is located in an OS specific cache location. |
| 128 |
usercache = /path/to/global/cache |
| 129 |
</pre> |
| 130 |
</div> |
| 131 |
<div class="section" id="commands"> |
| 132 |
<h1><a class="toc-backref" href="#contents">Commands</a></h1> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
</body> |
| 136 |
</html> |