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

Durham Goode durham at fb.com
Tue Mar 17 16:30:29 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 1b5c3b4c0fd1ff44c8226aa1818c094174cbbc2e
# 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,13 @@ 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....|
+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
 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