Skip to content
Snippets Groups Projects
test-lfs-largefiles.t 11.56 KiB
This tests the interaction between the largefiles and lfs extensions, and
conversion from largefiles -> lfs.

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > largefiles =
  > 
  > [lfs]
  > # standin files are 41 bytes.  Stay bigger for clarity.
  > threshold = 42
  > EOF

Setup a repo with a normal file and a largefile, above and below the lfs
threshold to test lfconvert.  *.txt start life as a normal file; *.bin start as
an lfs/largefile.

  $ hg init largefiles
  $ cd largefiles
  $ echo 'normal' > normal.txt
  $ echo 'normal above lfs threshold 0000000000000000000000000' > lfs.txt
  $ hg ci -Am 'normal.txt'
  adding lfs.txt
  adding normal.txt
  $ echo 'largefile' > large.bin
  $ echo 'largefile above lfs threshold 0000000000000000000000' > lfs.bin
  $ hg add --large large.bin lfs.bin
  $ hg ci -m 'add largefiles'

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > lfs =
  > EOF

Add an lfs file and normal file that collide with files on the other branch.
large.bin is added as a normal file, and is named as such only to clash with the
largefile on the other branch.

  $ hg up -q '.^'
  $ echo 'below lfs threshold' > large.bin
  $ echo 'lfs above the lfs threshold for length 0000000000000' > lfs.bin
  $ hg ci -Am 'add with lfs extension'
  adding large.bin
  adding lfs.bin
  created new head

  $ hg log -G
  @  changeset:   2:e989d0fa3764
  |  tag:         tip
  |  parent:      0:29361292f54d
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add with lfs extension
  |
  | o  changeset:   1:6513aaab9ca0
  |/   user:        test
  |    date:        Thu Jan 01 00:00:00 1970 +0000
  |    summary:     add largefiles
  |
  o  changeset:   0:29361292f54d
     user:        test
     date:        Thu Jan 01 00:00:00 1970 +0000
     summary:     normal.txt
  
--------------------------------------------------------------------------------
Merge largefiles into lfs branch

The largefiles extension will prompt to use the normal or largefile when merged
into the lfs files.  `hg manifest` will show standins if present.  They aren't,
because largefiles merge doesn't merge content.  If it did, selecting (n)ormal
would convert to lfs on commit, if appropriate.