/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/xml5.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from .. import (
 
17
from __future__ import absolute_import
 
18
 
 
19
from bzrlib import (
18
20
    cache_utf8,
19
21
    errors,
20
 
    osutils,
21
 
    )
22
 
from . import (
23
22
    inventory,
24
23
    xml6,
25
24
    )
26
 
from .xml_serializer import (
 
25
from bzrlib.xml_serializer import (
27
26
    encode_and_escape,
28
27
    get_utf8_or_ascii,
29
28
    unpack_inventory_entry,
35
34
 
36
35
    Packs objects into XML and vice versa.
37
36
    """
38
 
    format_num = b'5'
 
37
    format_num = '5'
39
38
    root_id = inventory.ROOT_ID
40
39
 
41
40
    def _unpack_inventory(self, elt, revision_id, entry_cache=None,
63
62
        byid = inv._byid
64
63
        for e in elt:
65
64
            ie = unpack_inventory_entry(e, entry_cache=entry_cache,
66
 
                                        return_from_cache=return_from_cache)
 
65
                              return_from_cache=return_from_cache)
67
66
            parent_id = ie.parent_id
68
67
            if parent_id is None:
69
68
                ie.parent_id = parent_id = root_id
73
72
                raise errors.BzrError("parent_id {%s} not in inventory"
74
73
                                      % (parent_id,))
75
74
            if ie.file_id in byid:
76
 
                raise inventory.DuplicateFileId(ie.file_id, byid[ie.file_id])
 
75
                raise errors.DuplicateFileId(ie.file_id,
 
76
                                             byid[ie.file_id])
77
77
            if ie.name in parent.children:
78
 
                raise errors.BzrError(
79
 
                    "%s is already versioned" % (
80
 
                        osutils.pathjoin(
81
 
                            inv.id2path(parent_id), ie.name).encode('utf-8'),))
 
78
                raise errors.BzrError("%s is already versioned"
 
79
                    % (osutils.pathjoin(inv.id2path(parent_id),
 
80
                       ie.name).encode('utf-8'),))
82
81
            parent.children[ie.name] = ie
83
82
            byid[ie.file_id] = ie
84
83
        if revision_id is not None:
98
97
    def _append_inventory_root(self, append, inv):
99
98
        """Append the inventory root to output."""
100
99
        if inv.root.file_id not in (None, inventory.ROOT_ID):
101
 
            fileid = b''.join([b' file_id="', encode_and_escape(inv.root.file_id), b'"'])
 
100
            fileid1 = ' file_id="'
 
101
            fileid2 = encode_and_escape(inv.root.file_id)
102
102
        else:
103
 
            fileid = b""
 
103
            fileid1 = ""
 
104
            fileid2 = ""
104
105
        if inv.revision_id is not None:
105
 
            revid = b''.join([b' revision_id="', encode_and_escape(inv.revision_id), b'"'])
 
106
            revid1 = ' revision_id="'
 
107
            revid2 = encode_and_escape(inv.revision_id)
106
108
        else:
107
 
            revid = b""
108
 
        append(b'<inventory%s format="5"%s>\n' % (fileid, revid))
 
109
            revid1 = ""
 
110
            revid2 = ""
 
111
        append('<inventory%s%s format="5"%s%s>\n' % (
 
112
            fileid1, fileid2, revid1, revid2))
109
113
 
110
114
 
111
115
serializer_v5 = Serializer_v5()