[MERGE] Fixed bug related to test_iter_changes_new breakage on Windows

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Apr 13 12:32:27 BST 2007


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.

-- 
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru



More information about the bazaar mailing list