[MERGE] Fixed bug related to test_iter_changes_new breakage on Windows
Alexander Belchenko
bialix at ukr.net
Fri Apr 13 13:17:30 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dmitry Vasiliev пишет:
> Alexander Belchenko wrote:
>> Alexander Belchenko has voted -0.
>> Status is now: Semi-approved
>> Comment:
>> I think this patch fix bug in wrong place.
>>
>> The main question: *why* this test pass on Linux and fails on Windows?
>> Probably because some core functions on Windows behaves differently?
>> In this case we need to fix bzrlib core, not the test.
>
> The patch fixed workingtree.WorkingTree._comparison_data() not the test.
> According to the tree.Tree._comparison_data() docstring the entry
> argument may be None if there is no inventory entry for the file. But
> the WorkingTree._comparison_data() implementation doesn't check for this
> case. The code only failed on Windows because 'entry.executable'
> expression is guarded by 'supports_executable()' condition and only
> executed on Windows. For example if you change the current code which
> looks like this:
>
> if not supports_executable():
> executable = entry.executable
> else:
> executable = bool(stat.S_ISREG(mode) and stat.S_ISEXEC & mode)
>
> to the equivalent but little bit less effective:
>
> executable = entry.executable
> if supports_executable():
> executable = bool(stat.S_ISREG(mode) and stat.S_ISEXEC & mode)
>
> the test (and the code) fail on any other platforms too.
OK. But I'm curious why this test was not fails before WT4 is introduced
and only starts to fails now with WT4. I'm hope there is not because
of some latent bug in workingtree_4.py.
Well, looking on your patch (that quite trivial) I'm think
it's probably better to use inline conditional expression, like this:
if not supports_executable():
- - executable = entry.executable
+ executable = bool(entry) and entry.executable
else:
executable = bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGH3TazYr338mxwCURAvDpAJ9rE8qMVfnYtYrcT3uUO7kGPfIGfQCggk8T
3FEwAJt1pyZwx8OxkSuAXg4=
=ugbz
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list