/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Vincent Ladeuil
  • Date: 2009-04-11 16:06:53 UTC
  • mto: (4286.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4287.
  • Revision ID: v.ladeuil+lp@free.fr-20090411160653-eq1gfn41q3lzhmss
Cleanup test imports and use features to better track skipped tests.

* bzrlib/tests/workingtree_implementations/__init__.py: 
Fix imports. Delete obsolete comment.

* bzrlib/tests/tree_implementations/test_walkdirs.py:
(TestWalkdirs.get_all_subdirs_expected): Reduce duplication.

* bzrlib/tests/tree_implementations/test_test_trees.py: 
Fix import.

* bzrlib/tests/tree_implementations/test_path_content_summary.py: 
Fix imports.

(TestPathContentSummary.test_unicode_symlink_content_summary,
TestPathContentSummary.test_unicode_symlink_target_summary):Use
UnicodeFilenameFeature instead of try/except UnicodeError.

* bzrlib/tests/tree_implementations/test_inv.py: 
Fix imports.
(TestInventoryWithSymlinks): Factor out test that requires
symlinks and use _test_needs_features.
(TestInventory.test_canonical_path,
TestInventory.test_canonical_path_dir,
TestInventory.test_canonical_path_root,
TestInventory.test_canonical_path_invalid_all,
TestInventory.test_canonical_invalid_child): Use assert(expected,
actual)

* bzrlib/tests/tree_implementations/test_get_symlink_target.py: 
Fix imports.
(TestGetSymlinkTarget.test_get_unicode_symlink_target): Use
UnicodeFilenameFeature instead of try/except UnicodeError.

* bzrlib/tests/tree_implementations/__init__.py: 
Fix imports.

(TestCaseWithTree.get_tree_with_subdirs_and_all_supported_content_types,
TestCaseWithTree._create_tree_with_utf8): Use
UnicodeFilenameFeature instead of try/except UnicodeError.

* bzrlib/tests/test_workingtree_4.py:
Fix too long lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
from bzrlib.xml_serializer import (
18
18
    Element,
 
19
    ElementTree,
19
20
    SubElement,
20
21
    XMLSerializer,
21
 
    escape_invalid_chars,
22
22
    )
23
 
from bzrlib.inventory import ROOT_ID, Inventory
 
23
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
24
24
import bzrlib.inventory as inventory
25
25
from bzrlib.revision import Revision
26
26
from bzrlib.errors import BzrError
62
62
        return e
63
63
 
64
64
 
65
 
    def _unpack_inventory(self, elt, revision_id=None, entry_cache=None,
66
 
                          return_from_cache=False):
 
65
    def _unpack_inventory(self, elt, revision_id=None, entry_cache=None):
67
66
        """Construct from XML Element
68
67
 
69
68
        :param revision_id: Ignored parameter used by xml5.
71
70
        root_id = elt.get('file_id') or ROOT_ID
72
71
        inv = Inventory(root_id)
73
72
        for e in elt:
74
 
            ie = self._unpack_entry(e, entry_cache=entry_cache,
75
 
                                    return_from_cache=return_from_cache)
 
73
            ie = self._unpack_entry(e, entry_cache=entry_cache)
76
74
            if ie.parent_id == ROOT_ID:
77
75
                ie.parent_id = root_id
78
76
            inv.add(ie)
79
77
        return inv
80
78
 
81
79
 
82
 
    def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
 
80
    def _unpack_entry(self, elt, entry_cache=None):
83
81
        ## original format inventories don't have a parent_id for
84
82
        ## nodes in the root directory, but it's cleaner to use one
85
83
        ## internally.
127
125
        root.text = '\n'
128
126
 
129
127
        msg = SubElement(root, 'message')
130
 
        msg.text = escape_invalid_chars(rev.message)[0]
 
128
        msg.text = rev.message
131
129
        msg.tail = '\n'
132
130
 
133
131
        if rev.parents: