~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to apply_changeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-14 00:52:22 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050714005222-36fd6b3ce894d7de
Tests pass. Now ChangesetTree has it's own inventory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
from bzrlib.trace import mutter, warning
10
10
 
11
 
def _install_info(branch, cset_info, cset_tree, cset_inv):
 
11
def _install_info(branch, cset_info, cset_tree):
12
12
    """Make sure that there is a text entry for each 
13
13
    file in the changeset.
14
14
    """
15
15
    from bzrlib.xml import pack_xml
16
16
    from cStringIO import StringIO
17
17
 
 
18
    inv = cset_tree.inventory
18
19
    # First, install all required texts
19
 
    for path, ie in cset_tree.inventory.iter_entries():
20
 
        if ie.text_id not in branch.text_store:
 
20
    for path, ie in inv.iter_entries():
 
21
        if ie.text_id is not None and ie.text_id not in branch.text_store:
21
22
            branch.text_store.add(cset_tree.get_file(ie.file_id), ie.text_id)
22
23
 
23
24
    # Now install the final inventory
28
29
            warning('Target inventory already exists in destination.')
29
30
        else:
30
31
            sio = StringIO()
31
 
            pack_xml(cset_inv, sio)
 
32
            pack_xml(inv, sio)
32
33
            branch.inventory_store.add(sio.getvalue(), cset_info.target)
33
34
            del sio
34
35
 
91
92
    """Apply an in-memory changeset to a given branch.
92
93
    """
93
94
 
94
 
    cset_info, cset_tree, cset_inv = cset
 
95
    cset_info, cset_tree = cset
95
96
 
96
 
    _install_info(branch, cset_info, cset_tree, cset_inv)
 
97
    _install_info(branch, cset_info, cset_tree)
97
98
 
98
99
    # We could technically optimize more, by using the ChangesetTree
99
100
    # we already have in memory, but after installing revisions