/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.5.17 by John Arbash Meinel
adding apply-changset, plus more meta information.
1
#!/usr/bin/env python
2
"""\
3
This contains the apply changset function for bzr
4
"""
5
6
import bzrlib
7
0.5.66 by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None)
8
def apply_changeset(branch, from_file, auto_commit=False):
9
    from bzrlib.merge import merge_inner
0.5.17 by John Arbash Meinel
adding apply-changset, plus more meta information.
10
    import sys, read_changeset
11
12
0.5.66 by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None)
13
    cset_info, cset_tree, cset_inv = read_changeset.read_changeset(from_file)
0.5.17 by John Arbash Meinel
adding apply-changset, plus more meta information.
14
15
    if auto_commit:
16
        from bzrlib.commit import commit
17
        if branch.last_patch() == cset_info.precursor:
18
            # This patch can be applied directly
19
            commit(branch, message = cset_info.message,
20
                    timestamp=float(cset_info.timestamp),
21
                    timezone=float(cset_info.timezone),
22
                    committer=cset_info.committer,
23
                    rev_id=cset_info.revision)
24
25