[BUG] can't rename subtrees

Aaron Bentley aaron.bentley at utoronto.ca
Sat Mar 31 21:44:20 BST 2007


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

Hi all,

I've found a bug in rename_one with dirstate trees().  If you try to
rename a subtree, you get this:

Traceback (most recent call last):
  File "/home/abentley/bzr/bzr.dev/bzrlib/tests/test_revert.py", line
121, in test_revert_subtree
    tree.rename_one('subtree', 'subtree2')
  File "/home/abentley/bzr/bzr.dev/bzrlib/mutabletree.py", line 40, in
tree_write_locked
    self.unlock()
  File "/home/abentley/bzr/bzr.dev/bzrlib/workingtree_4.py", line 1105,
in unlock
    self.flush()
  File "/home/abentley/bzr/bzr.dev/bzrlib/workingtree_4.py", line 310,
in flush
    self.current_dirstate().save()
  File "/home/abentley/bzr/bzr.dev/bzrlib/dirstate.py", line 1709, in save
    self._state_file.writelines(self.get_lines())
  File "/home/abentley/bzr/bzr.dev/bzrlib/dirstate.py", line 1201, in
get_lines
    lines.extend(map(self._entry_to_line, self._iter_entries()))
  File "/home/abentley/bzr/bzr.dev/bzrlib/dirstate.py", line 963, in
_entry_to_line
    return '\0'.join(entire_entry)

Here's the the test case:
=== modified file 'bzrlib/tests/test_revert.py'
- --- bzrlib/tests/test_revert.py 2007-03-01 01:02:30 +0000
+++ bzrlib/tests/test_revert.py 2007-03-31 20:39:14 +0000
@@ -108,3 +108,14 @@
         tt.apply()
         transform.revert(tree, tree.basis_tree(), [])
         self.assertTrue(tree.is_executable('newfile-id'))
+
+    def test_revert_subtree(self):
+        tree = self.make_branch_and_tree('tree',
+            format='dirstate-with-subtree')
+        subtree = self.make_branch_and_tree('tree/subtree',
+            format='dirstate-with-subtree')
+        self.build_tree(['tree/subtree/file'])
+        tree.add_reference(subtree)
+        subtree.add('file')
+        tree.commit('create nested tree')
+        tree.rename_one('subtree', 'subtree2')

Can someone take a look at this?  I don't know a lot about dirstate.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGDsgk0F+nu1YWqI0RAruEAJ9F5dL2HUY0DX8eL3AvyEX3Utm0PACfTEvH
FkTrWO7vtvM0vQSsXd+v6S8=
=7f/V
-----END PGP SIGNATURE-----



More information about the bazaar mailing list