~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    return tree, new_list
97
97
 
98
98
 
99
 
@symbol_versioning.deprecated_function(symbol_versioning.zero_fifteen)
100
 
def get_format_type(typestring):
101
 
    """Parse and return a format specifier."""
102
 
    # Have to use BzrDirMetaFormat1 directly, so that
103
 
    # RepositoryFormat.set_default_format works
104
 
    if typestring == "default":
105
 
        return bzrdir.BzrDirMetaFormat1()
106
 
    try:
107
 
        return bzrdir.format_registry.make_bzrdir(typestring)
108
 
    except KeyError:
109
 
        msg = 'Unknown bzr format "%s". See "bzr help formats".' % typestring
110
 
        raise errors.BzrCommandError(msg)
111
 
 
112
 
 
113
99
# TODO: Make sure no commands unconditionally use the working directory as a
114
100
# branch.  If a filename argument is used, the first of them should be used to
115
101
# specify the branch.  (Perhaps this can be factored out into some kind of
669
655
                raise errors.BzrCommandError(
670
656
                    'bzr pull --revision takes one value.')
671
657
 
672
 
        if verbose:
673
 
            old_rh = branch_to.revision_history()
674
 
        if tree_to is not None:
675
 
            change_reporter = delta._ChangeReporter(
676
 
                unversioned_filter=tree_to.is_ignored)
677
 
            result = tree_to.pull(branch_from, overwrite, revision_id,
678
 
                                  change_reporter,
679
 
                                  possible_transports=possible_transports)
680
 
        else:
681
 
            result = branch_to.pull(branch_from, overwrite, revision_id)
 
658
        branch_to.lock_write()
 
659
        try:
 
660
            if tree_to is not None:
 
661
                change_reporter = delta._ChangeReporter(
 
662
                    unversioned_filter=tree_to.is_ignored)
 
663
                result = tree_to.pull(branch_from, overwrite, revision_id,
 
664
                                      change_reporter,
 
665
                                      possible_transports=possible_transports)
 
666
            else:
 
667
                result = branch_to.pull(branch_from, overwrite, revision_id)
682
668
 
683
 
        result.report(self.outf)
684
 
        if verbose:
685
 
            new_rh = branch_to.revision_history()
686
 
            log.show_changed_revisions(branch_to, old_rh, new_rh,
687
 
                                       to_file=self.outf)
 
669
            result.report(self.outf)
 
670
            if verbose and result.old_revid != result.new_revid:
 
671
                old_rh = list(
 
672
                    branch_to.repository.iter_reverse_revision_history(
 
673
                    result.old_revid))
 
674
                old_rh.reverse()
 
675
                new_rh = branch_to.revision_history()
 
676
                log.show_changed_revisions(branch_to, old_rh, new_rh,
 
677
                                           to_file=self.outf)
 
678
        finally:
 
679
            branch_to.unlock()
688
680
 
689
681
 
690
682
class cmd_push(Command):
933
925
                revision_id = br_from.last_revision()
934
926
            if to_location is None:
935
927
                to_location = urlutils.derive_to_location(from_location)
936
 
                name = None
937
 
            else:
938
 
                name = os.path.basename(to_location) + '\n'
939
 
 
940
928
            to_transport = transport.get_transport(to_location)
941
929
            try:
942
930
                to_transport.mkdir('.')
957
945
                to_transport.delete_tree('.')
958
946
                msg = "The branch %s has no revision %s." % (from_location, revision[0])
959
947
                raise errors.BzrCommandError(msg)
960
 
            if name:
961
 
                branch.control_files.put_utf8('branch-name', name)
962
948
            _merge_tags_if_possible(br_from, branch)
963
949
            note('Branched %d revision(s).' % branch.revno())
964
950
        finally:
1298
1284
            last_revision = wt.last_revision()
1299
1285
 
1300
1286
        revision_ids = b.repository.get_ancestry(last_revision)
1301
 
        assert revision_ids[0] is None
1302
1287
        revision_ids.pop(0)
1303
1288
        for revision_id in revision_ids:
1304
1289
            self.outf.write(revision_id + '\n')
1723
1708
            message=None,
1724
1709
            limit=None):
1725
1710
        from bzrlib.log import show_log
1726
 
        assert message is None or isinstance(message, basestring), \
1727
 
            "invalid message argument %r" % message
1728
1711
        direction = (forward and 'forward') or 'reverse'
1729
1712
        
1730
1713
        # log everything
2653
2636
                            'known failures.'),
2654
2637
                     Option('load-list', type=str, argname='TESTLISTFILE',
2655
2638
                            help='Load a test id list from a text file.'),
 
2639
                     ListOption('debugflag', type=str, short_name='E',
 
2640
                                help='Turn on a selftest debug flag.'),
2656
2641
                     ]
2657
2642
    encoding_type = 'replace'
2658
2643
 
2661
2646
            lsprof_timed=None, cache_dir=None,
2662
2647
            first=False, list_only=False,
2663
2648
            randomize=None, exclude=None, strict=False,
2664
 
            load_list=None):
 
2649
            load_list=None, debugflag=None):
2665
2650
        import bzrlib.ui
2666
2651
        from bzrlib.tests import selftest
2667
2652
        import bzrlib.benchmarks as benchmarks
2704
2689
                              exclude_pattern=exclude,
2705
2690
                              strict=strict,
2706
2691
                              load_list=load_list,
 
2692
                              debug_flags=debugflag,
2707
2693
                              )
2708
2694
        finally:
2709
2695
            if benchfile is not None:
2917
2903
            merger.show_base = show_base
2918
2904
            self.sanity_check_merger(merger)
2919
2905
            if (merger.base_rev_id == merger.other_rev_id and
2920
 
                merger.other_rev_id != None):
 
2906
                merger.other_rev_id is not None):
2921
2907
                note('Nothing to do.')
2922
2908
                return 0
2923
2909
            if pull:
2978
2964
                                possible_transports, pb):
2979
2965
        """Produce a merger from a location, assuming it refers to a branch."""
2980
2966
        from bzrlib.tag import _merge_tags_if_possible
2981
 
        assert revision is None or len(revision) < 3
2982
2967
        # find the branch locations
2983
2968
        other_loc, user_location = self._select_branch_location(tree, location,
2984
2969
            revision, -1)
3665
3650
    specified revision.  For example, "bzr uncommit -r 15" will leave the
3666
3651
    branch at revision 15.
3667
3652
 
3668
 
    In the future, uncommit will create a revision bundle, which can then
3669
 
    be re-applied.
 
3653
    Uncommit leaves the working tree ready for a new commit.  The only change
 
3654
    it may make is to restore any pending merges that were present before
 
3655
    the commit.
3670
3656
    """
3671
3657
 
3672
3658
    # TODO: jam 20060108 Add an option to allow uncommit to remove