~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to baz_import.py

merge in storage api support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib.errors import BzrError
20
20
from bzrlib.errors import NotBranchError, BzrCommandError, NoSuchRevision
21
21
from bzrlib.branch import Branch
22
 
from bzrlib.clone import copy_branch
23
22
from bzrlib.commit import Commit, NullCommitReporter
24
23
from bzrlib.commands import Command
25
24
from bzrlib.option import _global_option
256
255
            else:
257
256
                raise
258
257
        try:
259
 
            copy_branch(br_from, to_location, revision_id, None)
 
258
            br_from.clone(to_location, revision_id, None)
260
259
        except NoSuchRevision:
261
260
            rmtree(to_location)
262
261
            msg = "The branch %s has no revision %s." % (from_location, revision_id)
422
421
                os.rename(bzr_dir, tmp_bzr_dir) # Move the original bzr out of the way
423
422
                os.rename(new_bzr_dir, bzr_dir)
424
423
                try:
425
 
                    bzrlib.merge.merge((output_dir, -1), (output_dir, None), # old_revno), 
426
 
                                       check_clean=False, this_dir=output_dir, 
427
 
                                       ignore_zero=True)
 
424
                    tree = WorkingTree(output_dir)
 
425
                    tree.revert([])
428
426
                except:
429
427
                    # If something failed, move back the original bzr directory
430
428
                    os.rename(bzr_dir, new_bzr_dir)
433
431
            else:
434
432
                # no imports - perhaps just append_revisions
435
433
                # should not fail:
436
 
                bzrlib.merge.merge((output_dir, -1), (output_dir, None), # old_revno), 
437
 
                                   check_clean=False, this_dir=output_dir, 
438
 
                                   ignore_zero=True)
 
434
                tree = WorkingTree(output_dir)
 
435
                tree.revert([])
439
436
        else:
440
437
            revdir = os.path.join(tempdir, "rd")
441
438
            os.rename(revdir, output_dir)
536
533
        if revdir is None and os.path.exists(output_dir):
537
534
            # check for imported revisions and if present just append immediately
538
535
            branch = Branch.open(output_dir)
539
 
            if branch.has_revision(rev_id):
 
536
            if branch.repository.has_revision(rev_id):
540
537
                branch.append_revision(rev_id)
541
538
                continue
542
539
        if revdir is None: