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

Durham Goode durham at fb.com
Wed Mar 18 17:01:01 CDT 2015



On 3/18/15 2:58 PM, Matt Mackall wrote:
> On Tue, 2015-03-17 at 14:30 -0700, Durham Goode wrote:
>> # 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
> Right, no errors..
>
>> +  $ 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'
> Wait, what were we testing again?
Well, I wanted to verify that the code path was actually hit.  I'm fine 
with it without the --debug though.
>
> I've dropped the --debug and added in the #if that Yuya mentioned,
> thanks.
>
If you added the #if manually, you can ignore my V2.  That was the only 
change.


More information about the Mercurial-devel mailing list