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