largefiles: add tests for uncovered codepaths (issue3092)
authorLevi Bard <levi@unity3d.com>
Sun, 08 Jan 2012 17:09:01 +0100
changeset 15810 3d11da212e30
parent 15809 884946c002b8
child 15811 b9886dde3649
largefiles: add tests for uncovered codepaths (issue3092) Add tests for lfconvert codepaths where: * largefiles have been both renamed and relinked * .hgtags has invalid content
tests/test-lfconvert.t
--- a/tests/test-lfconvert.t	Sun Jan 08 17:06:34 2012 +0100
+++ b/tests/test-lfconvert.t	Sun Jan 08 17:09:01 2012 +0100
@@ -3,6 +3,7 @@
   > largefiles =
   > share =
   > graphlog =
+  > mq =
   > [largefiles]
   > minsize = 0.5
   > patterns = **.other
@@ -18,21 +19,47 @@
   > EOF
   $ mkdir sub
   $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
+  $ dd if=/dev/zero bs=1k count=256 > large2 2> /dev/null
   $ echo normal > normal1
   $ echo alsonormal > sub/normal2
   $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
   $ hg addremove
   adding large
+  adding large2
   adding normal1
   adding sub/maybelarge.dat
   adding sub/normal2
   $ hg commit -m"add large, normal1" large normal1
   $ hg commit -m"add sub/*" sub
+Test tag parsing
+  $ cat >> .hgtags <<EOF
+  > IncorrectlyFormattedTag!
+  > invalidhash sometag
+  > 0123456789abcdef anothertag
+  > EOF
+  $ hg add .hgtags
+  $ hg commit -m"add large2" large2 .hgtags
+  $ hg rename large2 large3
+Test link+rename largefile codepath
+  $ ln -sf large large3
+  $ hg commit -m"make large2 a symlink" large2 large3
   $ [ -d .hg/largefiles ] && echo fail || echo pass
   pass
   $ cd ..
   $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
   initializing destination largefiles-repo
+  skipping incorrectly formatted tag IncorrectlyFormattedTag!
+  skipping incorrectly formatted id invalidhash
+  no mapping for id 0123456789abcdef
+  abort: renamed/copied largefile large3 becomes symlink
+  [255]
+  $ cd bigfile-repo
+  $ hg strip --no-backup 2
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ cd ..
+  $ rm -rf largefiles-repo
+  $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
+  initializing destination largefiles-repo
 
 "lfconvert" converts content correctly
   $ cd largefiles-repo