test_diff.TestDiffFromTool.test_prepare_files fails on Windows

Bug #212289 reported by Matt McClure
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Unassigned

Bug Description

C:\home\mlm\sandbox\bzr\repo\bzr.1.3>python bzr selftest DiffFromTool
testing: C:/home/mlm/sandbox/bzr/repo/bzr.1.3/bzr
   C:\home\mlm\sandbox\bzr\repo\bzr.1.3\bzrlib (1.3 python2.5.1.final.0)

ERROR: test_diff.TestDiffFromTool.test_prepare_files
    [Errno 2] No such file or directory: u'C:/docume~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/newname2
'

======================================================================
ERROR: test_prepare_files (bzrlib.tests.test_diff.TestDiffFromTool)

vvvv[log from bzrlib.tests.test_diff.TestDiffFromTool.test_prepare_files]-----
5.156 created control directory in file:///C:/docume%7E1/mlm/locals%7E1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/
5.172 creating repository in file:///C:/docume%7E1/mlm/locals%7E1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/.bzr/.
5.265 creating branch <bzrlib.branch.BzrBranchFormat6 object at 0x027A08D0> in file:///C:/docume%7E1/mlm/locals%7E1/tem
p/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/.bzr/
5.328 trying to create missing lock 'C:/docume~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/.bzr/checkout
/dirstate'
5.328 opening working tree 'C:/docume~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree'
5.406 preparing to commit
    INFO Committing to: C:/docume~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/
5.422 Selecting files for commit with filter None
    INFO added oldname
5.484 added revision_id {mlm@youk-19700101000000-hncbgh6ov4im97da}
    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~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp'

^^^^[log from bzrlib.tests.test_diff.TestDiffFromTool.test_prepare_files]-----
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\home\mlm\sandbox\bzr\repo\bzr.1.3\bzrlib\tests\test_diff.py", line 1304, in test_prepare_files
    diff_obj._prepare_files('file-id', 'oldname2', 'newname2')
  File "/c/home/mlm/sandbox/bzr/repo/bzr.1.3/bzrlib/diff.py", line 829, in _prepare_files
  File "/c/home/mlm/sandbox/bzr/repo/bzr.1.3/bzrlib/diff.py", line 811, in _write_file
  File "/c/home/mlm/sandbox/bzr/repo/bzr.1.3/bzrlib/workingtree.py", line 489, in get_file
  File "/c/home/mlm/sandbox/bzr/repo/bzr.1.3/bzrlib/workingtree.py", line 495, in get_file_byname
IOError: [Errno 2] No such file or directory: u'C:/docume~1/mlm/locals~1/temp/testbzr-_mpvy7.tmp/tmpmpu0u4/work/tree/new
name2'

----------------------------------------------------------------------
Ran 5 tests in 2.281s

FAILED (errors=1)
tests failed

Revision history for this message
Matt McClure (matthewlmcclure) wrote :
Revision history for this message
John A Meinel (jameinel) wrote :

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.

Vincent Ladeuil (vila)
Changed in bzr:
importance: Undecided → Low
milestone: none → 1.6
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.