revbranchcache: add test for when the cache is not writable
authorDurham Goode <durham@fb.com>
Tue, 17 Mar 2015 14:29:56 -0700
changeset 24372 577f65cf1a57
parent 24371 8a997bd73448
child 24373 59cc09240afb
revbranchcache: add test for when the cache is not writable The revbranchecache code already handled the case when the cache file wasn't writable, but let's add a test as well so future changes don't regress this.
tests/test-branches.t
--- a/tests/test-branches.t	Tue Mar 17 13:06:15 2015 -0700
+++ b/tests/test-branches.t	Tue Mar 17 14:29:56 2015 -0700
@@ -547,6 +547,17 @@
   0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
   0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
   0070: f8 94 c2 56 80 00 00 03                         |...V....|
+
+#if unix-permissions no-root
+no errors when revbranchcache is not writable
+
+  $ echo >> .hg/cache/rbc-revs-v1
+  $ chmod a-w .hg/cache/rbc-revs-v1
+  $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
+  5
+  $ chmod a+w .hg/cache/rbc-revs-v1
+#endif
+
 recovery from invalid cache revs file with trailing data
   $ echo >> .hg/cache/rbc-revs-v1
   $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug