diff tests/test-largefiles.t @ 15792:7cbba3adabc7

largefiles: implement addremove (issue3064) Implementing addremove correctly in largefiles is tricky, becuase the original addremove function does not call into any of the add or remove function we've already overridden in the extension. So the trick is to implement addremove without duplicating any code. This patch implements addremove by pulling out the interesting parts of override_add() and override_remove() into generic utility functions, and using those to handle the largefiles in addremove. Then a matcher is installed that will ignore all largefiles, and the original addremove function is called to take care of the regular files in addremove. A small bit of monkey patching is used to make sure that remove_largefiles() notifies the user when a file is removed by addremove and also makes sure the removal of largefiles doesn't interfer with the original addremove's operation of removing the standin.
author Na'Tosha Bard <natosha@unity3d.com>
date Sat, 07 Jan 2012 12:42:54 +0100
parents 07b6af9076b4
children 8bed8551d535
line wrap: on
line diff
--- a/tests/test-largefiles.t	Sun Jan 08 18:15:54 2012 +0100
+++ b/tests/test-largefiles.t	Sat Jan 07 12:42:54 2012 +0100
@@ -286,6 +286,20 @@
   $ cat sub2/large7
   large7
 
+Test addremove: verify that files that should be added as largfiles are added as
+such and that already-existing largfiles are not added as normal files by
+accident.
+
+  $ rm normal3
+  $ rm sub/large4
+  $ echo "testing addremove with patterns" > testaddremove.dat
+  $ echo "normaladdremove" > normaladdremove
+  $ hg addremove
+  removing sub/large4
+  adding testaddremove.dat as a largefile
+  removing normal3
+  adding normaladdremove
+
 Clone a largefiles repo.
 
   $ hg clone . ../b