tests/test-lfs.t
changeset 35665 1ad1e59b405e
parent 35663 a985834961f7
child 35731 f58245b9e3ea
equal deleted inserted replaced
35664:3c838bdc57b6 35665:1ad1e59b405e
   935   $ cd $TESTTMP/repo-del
   935   $ cd $TESTTMP/repo-del
   936   $ echo 1 > A
   936   $ echo 1 > A
   937   $ hg commit -m 'add A' -A A
   937   $ hg commit -m 'add A' -A A
   938   $ hg rm A
   938   $ hg rm A
   939   $ hg commit -m 'rm A'
   939   $ hg commit -m 'rm A'
       
   940 
       
   941 Bad .hglfs files will block the commit with a useful message
       
   942 
       
   943   $ cat > .hglfs << EOF
       
   944   > [track]
       
   945   > **.test = size(">5B")
       
   946   > bad file ... no commit
       
   947   > EOF
       
   948 
       
   949   $ echo x > file.txt
       
   950   $ hg ci -Aqm 'should fail'
       
   951   hg: parse error at .hglfs:3: bad file ... no commit
       
   952   [255]
       
   953 
       
   954   $ cat > .hglfs << EOF
       
   955   > [track]
       
   956   > **.test = size(">5B")
       
   957   > ** = nonexistent()
       
   958   > EOF
       
   959 
       
   960   $ hg ci -Aqm 'should fail'
       
   961   abort: parse error in .hglfs: unknown identifier: nonexistent
       
   962   [255]
       
   963 
       
   964 '**' works out to mean all files.
       
   965 
       
   966   $ cat > .hglfs << EOF
       
   967   > [track]
       
   968   > **.test = size(">5B")
       
   969   > **.exclude = none()
       
   970   > ** = size(">10B")
       
   971   > EOF
       
   972 
       
   973 The LFS policy takes effect as the .hglfs file is committed
       
   974 
       
   975   $ echo 'largefile' > lfs.test
       
   976   $ echo '012345678901234567890' > nolfs.exclude
       
   977   $ echo '01234567890123456' > lfs.catchall
       
   978   $ hg ci -Aqm 'added .hglfs'
       
   979   $ hg log -r . -T '{rev}: {lfs_files % "{file}: {oid}\n"}\n'
       
   980   2: lfs.catchall: d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9
       
   981   lfs.test: 5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c
       
   982   
       
   983 The existing .hglfs file is used even when it is not in the 'A' or 'M' states
       
   984 
       
   985   $ echo 'largefile2' > lfs.test
       
   986   $ echo '012345678901234567890a' > nolfs.exclude
       
   987   $ echo '01234567890123456a' > lfs.catchall
       
   988   $ hg ci -qm 'unmodified .hglfs'
       
   989   $ hg log -r . -T '{rev}: {lfs_files % "{file}: {oid}\n"}\n'
       
   990   3: lfs.catchall: 31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573
       
   991   lfs.test: 8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6
       
   992   
       
   993 Excluding the .hglfs file from the commit postpones the policy change
       
   994 
       
   995   $ hg rm .hglfs
       
   996   $ echo 'largefile3' > lfs.test
       
   997   $ echo '012345678901234567890abc' > nolfs.exclude
       
   998   $ echo '01234567890123456abc' > lfs.catchall
       
   999   $ hg ci -qm 'file test' -X .hglfs
       
  1000   $ hg log -r . -T '{rev}: {lfs_files % "{file}: {oid}\n"}\n'
       
  1001   4: lfs.catchall: 6747cfb1b83965b4a884e7a6061813ae31e4122028bc6a88d2ac5e5f9e05c5af
       
  1002   lfs.test: 3f40b70c2294e91e0fa789ebcf73c5a1d1c7aef270f83e477e40cb0513237e8c
       
  1003   
       
  1004 The policy change takes effect when the .hglfs is committed
       
  1005 
       
  1006   $ echo 'largefile4' > lfs.test
       
  1007   $ echo '012345678901234567890abcdef' > nolfs.exclude
       
  1008   $ echo '01234567890123456abcdef' > lfs.catchall
       
  1009   $ hg ci -qm 'file test'
       
  1010   $ hg log -r . -T '{rev}: {lfs_files % "{file}: {oid}\n"}\n'
       
  1011   5: 
       
  1012 
   940   $ cd ..
  1013   $ cd ..
   941 
  1014 
   942 Unbundling adds a requirement to a non-lfs repo, if necessary.
  1015 Unbundling adds a requirement to a non-lfs repo, if necessary.
   943 
  1016 
   944   $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg
  1017   $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg