~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
 
2
#
1
3
# This program is free software; you can redistribute it and/or modify
2
4
# it under the terms of the GNU General Public License as published by
3
5
# the Free Software Foundation; either version 2 of the License, or
12
14
# along with this program; if not, write to the Free Software
13
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
16
 
15
 
 
16
17
from bzrlib.xml_serializer import ElementTree, SubElement, Element, Serializer
17
18
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
18
19
import bzrlib.inventory as inventory
20
21
from bzrlib.errors import BzrError
21
22
 
22
23
 
23
 
 
24
 
 
25
 
 
26
 
 
27
24
class _Serializer_v4(Serializer):
28
25
    """Version 0.0.4 serializer
29
26
 
51
48
        e.set('file_id', ie.file_id)
52
49
        e.set('kind', ie.kind)
53
50
 
54
 
        if ie.text_size != None:
 
51
        if ie.text_size is not None:
55
52
            e.set('text_size', '%d' % ie.text_size)
56
53
 
57
54
        for f in ['text_id', 'text_sha1', 'symlink_target']:
58
55
            v = getattr(ie, f)
59
 
            if v != None:
 
56
            if v is not None:
60
57
                e.set(f, v)
61
58
 
62
59
        # to be conservative, we don't externalize the root pointers
92
89
        ## nodes in the root directory, but it's cleaner to use one
93
90
        ## internally.
94
91
        parent_id = elt.get('parent_id')
95
 
        if parent_id == None:
 
92
        if parent_id is None:
96
93
            parent_id = ROOT_ID
97
94
 
98
95
        kind = elt.get('kind')