15168
|
1 |
Largefiles allows for tracking large, incompressible binary files in Mercurial
|
|
2 |
without requiring excessive bandwidth for clones and pulls. Files added as
|
|
3 |
largefiles are not tracked directly by Mercurial; rather, their revisions are
|
|
4 |
identified by a checksum, and Mercurial tracks these checksums. This way, when
|
|
5 |
you clone a repository or pull in changesets, the large files in older
|
|
6 |
revisions of the repository are not needed, and only the ones needed to update
|
|
7 |
to the current version are downloaded. This saves both disk space and
|
|
8 |
bandwidth.
|
|
9 |
|
|
10 |
If you are starting a new repository or adding new large binary files, using
|
|
11 |
largefiles for them is as easy as adding '--large' to your hg add command. For
|
|
12 |
example:
|
|
13 |
|
|
14 |
$ dd if=/dev/urandom of=thisfileislarge count=2000
|
|
15 |
$ hg add --large thisfileislarge
|
|
16 |
$ hg commit -m 'add thisfileislarge, which is large, as a largefile'
|
|
17 |
|
|
18 |
When you push a changeset that affects largefiles to a remote repository, its
|
|
19 |
largefile revisions will be uploaded along with it. Note that the remote
|
|
20 |
Mercurial must also have the largefiles extension enabled for this to work.
|
|
21 |
|
|
22 |
When you pull a changeset that affects largefiles from a remote repository,
|
|
23 |
nothing different from Mercurial's normal behavior happens. However, when you
|
|
24 |
update to such a revision, any largefiles needed by that revision are
|
|
25 |
downloaded and cached if they have never been downloaded before. This means
|
|
26 |
that network access is required to update to revision you have not yet updated
|
|
27 |
to.
|
|
28 |
|
|
29 |
If you already have large files tracked by Mercurial without the largefiles
|
|
30 |
extension, you will need to convert your repository in order to benefit from
|
|
31 |
largefiles. This is done with the 'hg lfconvert' command:
|
|
32 |
|
|
33 |
$ hg lfconvert --size 10 oldrepo newrepo
|
|
34 |
|
|
35 |
By default, in repositories that already have largefiles in them, any new file
|
|
36 |
over 10MB will automatically be added as largefiles. To change this
|
|
37 |
threshhold, set [largefiles].size in your Mercurial config file to the minimum
|
|
38 |
size in megabytes to track as a largefile, or use the --lfsize option to the
|
|
39 |
add command (also in megabytes):
|
|
40 |
|
|
41 |
[largefiles]
|
|
42 |
size = 2
|
|
43 |
|
|
44 |
$ hg add --lfsize 2
|
|
45 |
|
|
46 |
The [largefiles].patterns config option allows you to specify specific
|
|
47 |
space-separated filename patterns (in shell glob syntax) that should always be
|
|
48 |
tracked as largefiles:
|
|
49 |
|
|
50 |
[largefiles]
|
|
51 |
pattens = *.jpg *.{png,bmp} library.zip content/audio/*
|