[Merge][#111665] bzr rm should remove clean subtrees

Alexander Belchenko bialix at ukr.net
Tue Aug 14 14:51:10 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marius,

It's not directly related to your current patch,
but related to rm functionality and rm testing in general.
The code I talking about was already merged,
so I assume it was reviewed, and therefore correct.

Unfortunately one test method is win32 unsafe.

blackbox/test_remove.py

    def test_remove_changed_files_from_child_dir(self):
        tree = self._make_add_and_assert_tree(files)
        self.run_bzr("commit -m 'added files'")
        self.changeFile(a)
        self.changeFile(c)
        os.chdir('b')
        self.run_bzr_remove_changed_files(['modified:[.\s]*a[.\s]*b/c'],
            ['../a', 'c', '.', '../d'])
        os.chdir('..')
        self.assertNotInWorkingTree(files)
        self.failIfExists(files)

You try to remove directory when you're inside this directory.
You cannot do this on Windows. And running tests on win32
clearly shows this limitation:

FAIL: blackbox.test_remove.TestRemove.test_remove_changed_files_from_child_dir
    Unexpected return code
not equal:
a = 0
b = 3


run bzr: ['remove', '--force', '../a', 'c', '.', '../d']
bzr arguments: ['remove', '--force', '../a', 'c', '.', '../d']
encoding stdout as sys.stdout encoding 'cp1251'
opening working tree 'C:/docume~1/modul98/locals~1/temp/testbzr-i_eonr.tmp/tmpe_aicr/work'
    INFO  deleted d
    INFO  deleted b/c
Traceback (most recent call last):
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\commands.py", line 817, in run_bzr_catch_errors
    return run_bzr(argv)
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\commands.py", line 779, in run_bzr
    ret = run(*run_argv)
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\commands.py", line 477, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\builtins.py", line 1116, in run
    force=file_deletion_strategy=='force')
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\mutabletree.py", line 50, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\workingtree.py", line 1892, in remove
    osutils.delete_any(abs_path)
  File "E:\Bazaar\mydev\rm.subdirs\bzrlib\osutils.py", line 812, in delete_any
    os.rmdir(full_path)
OSError: [Errno 13] Permission denied:
u'C:/docume~1/modul98/locals~1/temp/testbzr-i_eonr.tmp/tmpe_aicr/work/b'

errors:
"deleted d\ndeleted b/c\nbzr: ERROR: [Errno 13] Permission denied:
u'C:/docume~1/modul98/locals~1/temp/testbzr-i_eonr.tmp/tmpe_aicr/work/b'\n"


If the test method is correct and should be run in this manner,
then it should be explicitly skipped on win32.
I'll try to fix it when I'll return from vacation in September,
or you can prepare a patch if you wish.

[µ]


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGwbNOzYr338mxwCURAmSTAJ0Zhn1I2a3VV9HgXMrjSkPm9yr/iwCY+tGK
C1/+RzyalEun59ALlVTEqA==
=RQut
-----END PGP SIGNATURE-----



More information about the bazaar mailing list