test_diff.TestDiffFromTool.test_prepare_files fails on Windows
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Low
|
Unassigned |
Bug Description
C:\home\
testing: C:/home/
C:\home\
ERROR: test_diff.
[Errno 2] No such file or directory: u'C:/docume~
'
=======
ERROR: test_prepare_files (bzrlib.
vvvv[log from bzrlib.
5.156 created control directory in file://
5.172 creating repository in file://
5.265 creating branch <bzrlib.
p/testbzr-
5.328 trying to create missing lock 'C:/docume~
/dirstate'
5.328 opening working tree 'C:/docume~
5.406 preparing to commit
INFO Committing to: C:/docume~
5.422 Selecting files for commit with filter None
INFO added oldname
5.484 added revision_id {mlm@youk-
INFO Committed revision 1.
5.547 rename_one:
from_id {file-id}
from_rel: 'oldname'
to_rel: 'newname'
to_dir ''
to_dir_id {TREE_ROOT}
5.609 opening working tree 'C:/docume~
^^^^[log from bzrlib.
-------
Traceback (most recent call last):
File "C:\home\
diff_
File "/c/home/
File "/c/home/
File "/c/home/
File "/c/home/
IOError: [Errno 2] No such file or directory: u'C:/docume~
name2'
-------
Ran 5 tests in 2.281s
FAILED (errors=1)
tests failed
Changed in bzr: | |
importance: | Undecided → Low |
milestone: | none → 1.6 |
status: | New → Fix Released |
The test itself seems to be doing something broken. Specifically it is doing:
diff_obj. _prepare_ files(' file-id' , 'oldname2', 'newname2')
which does 2 things
1) gets the file content from tree.get_ file(file_ id, relpath)
2) writes the content to join(self._root, prefix, relpath)
The problem is step (1). WorkingTree. get_file( file_id, path=None) takes an optional path which you have ensured is the same location as the given file id. But in this context, it is wrong. ('file-id' exists at 'newname', not 'newname2') Even with Matt's patch, it is still working for the wrong reason ('newname2' is 'file-id2', not 'file-id').
I'm not 100% sure what was being tested here, I'm guessing the proper fix *might* be Matt's fix with a final change to use 'file-id2' in the final 'prepare_files'.
We also need to figure out why this works on the PQM, or this would not be in mainline.