remotefilelog: avoid hard-coding pack names in tests
authorAugie Fackler <augie@google.com>
Wed, 03 Oct 2018 23:47:43 -0400
changeset 40505 b6b2a3d22344
parent 40504 64b16de2c66a
child 40506 10c10da14c5d
remotefilelog: avoid hard-coding pack names in tests I'm about to alter the pack format, which alters the content-addressed name of the pack file. In order to reduce my own confusion I found it helpful to use an ls | head pipeline since we always want to inspect the newest pack. Differential Revision: https://phab.mercurial-scm.org/D4942
tests/test-remotefilelog-bgprefetch.t
tests/test-remotefilelog-gcrepack.t
--- a/tests/test-remotefilelog-bgprefetch.t	Tue Oct 16 14:04:41 2018 -0400
+++ b/tests/test-remotefilelog-bgprefetch.t	Wed Oct 03 23:47:43 2018 -0400
@@ -153,7 +153,7 @@
 # Ensure that file 'w' was prefetched - it was not part of the update operation and therefore
 # could only be downloaded by the background prefetch
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
   w:
   Node          Delta Base    Delta Length  Blob Size
@@ -205,7 +205,7 @@
 # Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore
 # could only be downloaded by the background prefetch
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
   w:
   Node          Delta Base    Delta Length  Blob Size
@@ -248,7 +248,7 @@
 # Ensure that file 'y' was prefetched - it was not part of the rebase operation and therefore
 # could only be downloaded by the background prefetch
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
   w:
   Node          Delta Base    Delta Length  Blob Size
@@ -295,7 +295,7 @@
   $TESTTMP/hgcache/repos
 
 # Ensure that files were prefetched
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
   w:
   Node          Delta Base    Delta Length  Blob Size
@@ -339,7 +339,7 @@
   $TESTTMP/hgcache/repos
 
 # Ensure that files were prefetched
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
   w:
   Node          Delta Base    Delta Length  Blob Size
--- a/tests/test-remotefilelog-gcrepack.t	Tue Oct 16 14:04:41 2018 -0400
+++ b/tests/test-remotefilelog-gcrepack.t	Wed Oct 03 23:47:43 2018 -0400
@@ -50,7 +50,7 @@
 
 # Ensure that all file versions were prefetched
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
   x:
   Node          Delta Base    Delta Length  Blob Size
@@ -84,7 +84,7 @@
 # Ensure that file 'x' was garbage collected. It should be GCed because it is not in the keepset
 # and is old (commit date is 0.0 in tests). Ensure that file 'y' is present as it is in the keepset.
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33:
   y:
   Node          Delta Base    Delta Length  Blob Size
@@ -111,7 +111,7 @@
 
 # Ensure that all file versions were prefetched
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
   x:
   Node          Delta Base    Delta Length  Blob Size
@@ -145,7 +145,7 @@
 
 # Ensure that all file versions were prefetched
 
-  $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+  $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
   $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
   x:
   Node          Delta Base    Delta Length  Blob Size