~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-04 05:44:40 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-20050704054440-ed584dd40745fdde
Refactoring, moving test code into test (switching back to assert is None)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
import bzrlib
7
7
 
8
 
def apply_changeset(branch, from_file, reverse=False, auto_commit=False):
9
 
    from bzrlib.changeset import apply_changeset as _apply_changeset
10
 
    from bzrlib.merge import regen_inventory
 
8
def apply_changeset(branch, from_file, auto_commit=False):
 
9
    from bzrlib.merge import merge_inner
11
10
    import sys, read_changeset
12
11
 
13
12
 
14
 
    cset_info = read_changeset.read_changeset(from_file)
15
 
    cset = cset_info.get_changeset()
16
 
    inv = {}
17
 
    for file_id in branch.inventory:
18
 
        inv[file_id] = branch.inventory.id2path(file_id)
19
 
    changes = _apply_changeset(cset, inv, branch.base,
20
 
            reverse=reverse)
21
 
 
22
 
    adjust_ids = []
23
 
    for id, path in changes.iteritems():
24
 
        if path is not None:
25
 
            if path == '.':
26
 
                path = ''
27
 
        adjust_ids.append((path, id))
28
 
 
29
 
    branch.set_inventory(regen_inventory(branch, branch.base, adjust_ids))
 
13
    cset_info, cset_tree, cset_inv = read_changeset.read_changeset(from_file)
30
14
 
31
15
    if auto_commit:
32
16
        from bzrlib.commit import commit