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

Use new fastexport import processor in Dulwich.

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
    takes_args = ["patches*"]
208
208
 
209
209
    def _apply_patch(self, wt, f):
 
210
        from bzrlib.errors import BzrCommandError
210
211
        from dulwich.patch import git_am_patch_split
 
212
        import subprocess
211
213
        (c, diff, version) = git_am_patch_split(f)
212
 
        # FIXME: Process diff
213
 
        wt.commit(committer=c.committer,
214
 
                  message=c.message)
 
214
        # FIXME: Cope with git-specific bits in patch
 
215
        p = subprocess.Popen(["patch", "-p1"], stdin=subprocess.PIPE, cwd=wt.basedir)
 
216
        p.communicate(diff)
 
217
        exitcode = p.wait()
 
218
        if exitcode != 0:
 
219
            raise BzrCommandError("error running patch")
 
220
        wt.commit(authors=[c.author], message=c.message)
215
221
 
216
222
    def run(self, patches_list=None):
 
223
        from bzrlib.errors import UncommittedChanges
217
224
        from bzrlib.workingtree import WorkingTree
218
225
        if patches_list is None:
219
226
            patches_list = []
220
 
        
 
227
 
221
228
        tree, _ = WorkingTree.open_containing(".")
 
229
        if tree.basis_tree().changes_from(tree).has_changed():
 
230
            raise UncommittedChanges(tree)
222
231
        tree.lock_write()
223
232
        try:
224
233
            for patch in patches_list: