~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-03 20:18:35 UTC
  • mfrom: (1185.82.137 w-changeset)
  • Revision ID: pqm@pqm.ubuntu.com-20060603201835-1c9a1725641ccd24
Implement bundles

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import bzrlib.branch
26
26
from bzrlib.branch import Branch
27
27
import bzrlib.bzrdir as bzrdir
 
28
from bzrlib.bundle.read_bundle import BundleReader
 
29
from bzrlib.bundle.apply_bundle import merge_bundle
28
30
from bzrlib.commands import Command, display_command
29
31
import bzrlib.errors as errors
30
32
from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError, 
31
33
                           NotBranchError, DivergedBranches, NotConflicted,
32
34
                           NoSuchFile, NoWorkingTree, FileInWrongBranch,
33
 
                           NotVersionedError)
 
35
                           NotVersionedError, BadBundle)
34
36
from bzrlib.log import show_one_log
35
37
from bzrlib.merge import Merge3Merger
36
38
from bzrlib.option import Option
2004
2006
        if merge_type is None:
2005
2007
            merge_type = Merge3Merger
2006
2008
 
 
2009
 
2007
2010
        tree = WorkingTree.open_containing(u'.')[0]
 
2011
        try:
 
2012
            if branch is not None:
 
2013
                reader = BundleReader(file(branch, 'rb'))
 
2014
            else:
 
2015
                reader = None
 
2016
        except IOError, e:
 
2017
            if e.errno not in (errno.ENOENT, errno.EISDIR):
 
2018
                raise
 
2019
            reader = None
 
2020
        except BadBundle:
 
2021
            reader = None
 
2022
        if reader is not None:
 
2023
            conflicts = merge_bundle(reader, tree, not force, merge_type,
 
2024
                                        reprocess, show_base)
 
2025
            if conflicts == 0:
 
2026
                return 0
 
2027
            else:
 
2028
                return 1
 
2029
 
2008
2030
        stored_loc = tree.branch.get_parent()
2009
2031
        if branch is None:
2010
2032
            if stored_loc is None:
2485
2507
    --dry-run will go through all the motions, but not actually
2486
2508
    remove anything.
2487
2509
    
2488
 
    In the future, uncommit will create a changeset, which can then
 
2510
    In the future, uncommit will create a revision bundle, which can then
2489
2511
    be re-applied.
2490
2512
    """
2491
2513
 
2645
2667
# aliases.  ideally we would avoid loading the implementation until the
2646
2668
# details were needed.
2647
2669
from bzrlib.conflicts import cmd_resolve, cmd_conflicts, restore
 
2670
from bzrlib.bundle.commands import cmd_bundle_revisions
2648
2671
from bzrlib.sign_my_commits import cmd_sign_my_commits
2649
2672
from bzrlib.weave_commands import cmd_weave_list, cmd_weave_join, \
2650
2673
        cmd_weave_plan_merge, cmd_weave_merge_text