~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-15 22:51:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1785.
  • Revision ID: john@arbash-meinel.com-20060615225105-76036f35e8616466
Allow pull to use a bundle as a target,
fix the merge code to work again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import bzrlib.branch
28
28
from bzrlib.branch import Branch
29
29
import bzrlib.bzrdir as bzrdir
 
30
from bzrlib.bundle import read_bundle_from_url
30
31
from bzrlib.bundle.read_bundle import BundleReader
31
 
from bzrlib.bundle.apply_bundle import merge_bundle
 
32
from bzrlib.bundle.apply_bundle import install_bundle, merge_bundle
32
33
from bzrlib.commands import Command, display_command
33
34
import bzrlib.errors as errors
34
35
from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError, 
434
435
        except NoWorkingTree:
435
436
            tree_to = None
436
437
            branch_to = Branch.open_containing(u'.')[0]
 
438
 
 
439
        reader = None
 
440
        if location is not None:
 
441
            try:
 
442
                reader = read_bundle_from_url(location)
 
443
            except NotABundle:
 
444
                pass # Continue on considering this url a Branch
 
445
 
437
446
        stored_loc = branch_to.get_parent()
438
447
        if location is None:
439
448
            if stored_loc is None:
444
453
                self.outf.write("Using saved location: %s\n" % display_url)
445
454
                location = stored_loc
446
455
 
447
 
        branch_from = Branch.open(location)
448
 
 
449
 
        if branch_to.get_parent() is None or remember:
450
 
            branch_to.set_parent(branch_from.base)
451
 
 
 
456
 
 
457
        if reader is not None:
 
458
            install_bundle(branch_to.repository, reader)
 
459
            branch_from = branch_to
 
460
        else:
 
461
            branch_from = Branch.open(location)
 
462
 
 
463
            if branch_to.get_parent() is None or remember:
 
464
                branch_to.set_parent(branch_from.base)
 
465
 
 
466
        rev_id = None
452
467
        if revision is None:
453
 
            rev_id = None
 
468
            if reader is not None:
 
469
                rev_id = reader.info.target
454
470
        elif len(revision) == 1:
455
471
            rev_id = revision[0].in_history(branch_from).rev_id
456
472
        else:
2052
2068
 
2053
2069
        tree = WorkingTree.open_containing(u'.')[0]
2054
2070
 
2055
 
        try:
2056
 
            reader = read_bundle(branch)
2057
 
        except NotABundle:
2058
 
            pass # Continue on considering this url a Branch
2059
 
        else:
2060
 
            conflicts = merge_bundle(reader, tree, not force, merge_type,
2061
 
                                        reprocess, show_base)
2062
 
            if conflicts == 0:
2063
 
                return 0
 
2071
        if branch is not None:
 
2072
            try:
 
2073
                reader = read_bundle_from_url(branch)
 
2074
            except NotABundle:
 
2075
                pass # Continue on considering this url a Branch
2064
2076
            else:
2065
 
                return 1
 
2077
                conflicts = merge_bundle(reader, tree, not force, merge_type,
 
2078
                                            reprocess, show_base)
 
2079
                if conflicts == 0:
 
2080
                    return 0
 
2081
                else:
 
2082
                    return 1
2066
2083
 
2067
2084
        branch = self._get_remembered_parent(tree, branch, 'Merging from')
2068
2085