[PATCH V2] revbranchcache: add test for when the cache is not writable

Durham Goode durham at fb.com
Wed Mar 18 12:10:52 CDT 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1426627796 25200
#      Tue Mar 17 14:29:56 2015 -0700
# Node ID 0bd9d2392a53fb6b5b9deac82d6fb29c80c6a572
# Parent  567ae53657544744155897ada91f16f8af61ad8a
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.

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -547,6 +547,17 @@ revision branch cache is created when bu
   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' --debug
+  couldn't write revision branch cache: [Errno 13] Permission denied: '$TESTTMP/a/.hg/cache/rbc-revs-v1'
+  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


More information about the Mercurial-devel mailing list