/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 bzrlib/builtins.py

  • Committer: Martin Pool
  • Date: 2010-02-09 19:04:02 UTC
  • mfrom: (5010 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5019.
  • Revision ID: mbp@canonical.com-20100209190402-2xbzrchmb4dfi2j7
Resolve conflicts with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
2191
2191
    :Tips & tricks:
2192
2192
 
2193
2193
      GUI tools and IDEs are often better at exploring history than command
2194
 
      line tools. You may prefer qlog or glog from the QBzr and Bzr-Gtk packages
2195
 
      respectively for example. (TortoiseBzr uses qlog for displaying logs.) See
2196
 
      http://bazaar-vcs.org/BzrPlugins and http://bazaar-vcs.org/IDEIntegration.
2197
 
 
2198
 
      Web interfaces are often better at exploring history than command line
2199
 
      tools, particularly for branches on servers. You may prefer Loggerhead
2200
 
      or one of its alternatives. See http://bazaar-vcs.org/WebInterface.
 
2194
      line tools: you may prefer qlog or viz from qbzr or bzr-gtk, the
 
2195
      bzr-explorer shell, or the Loggerhead web interface.  See the Plugin
 
2196
      Guide <http://doc.bazaar.canonical.com/plugins/en/> and
 
2197
      <http://wiki.bazaar.canonical.com/IDEIntegration>.  
2201
2198
 
2202
2199
      You may find it useful to add the aliases below to ``bazaar.conf``::
2203
2200
 
2609
2606
    After adding, editing or deleting that file either indirectly by
2610
2607
    using this command or directly by using an editor, be sure to commit
2611
2608
    it.
 
2609
    
 
2610
    Patterns prefixed with '!' are exceptions to ignore patterns and take
 
2611
    precedence over regular ignores.  Such exceptions are used to specify
 
2612
    files that should be versioned which would otherwise be ignored.
 
2613
    
 
2614
    Patterns prefixed with '!!' act as regular ignore patterns, but have
 
2615
    precedence over the '!' exception patterns.
2612
2616
 
2613
2617
    Note: ignore patterns containing shell wildcards must be quoted from
2614
2618
    the shell on Unix.
2618
2622
 
2619
2623
            bzr ignore ./Makefile
2620
2624
 
2621
 
        Ignore class files in all directories::
 
2625
        Ignore .class files in all directories...::
2622
2626
 
2623
2627
            bzr ignore "*.class"
2624
2628
 
 
2629
        ...but do not ignore "special.class"::
 
2630
 
 
2631
            bzr ignore "!special.class"
 
2632
 
2625
2633
        Ignore .o files under the lib directory::
2626
2634
 
2627
2635
            bzr ignore "lib/**/*.o"
2633
2641
        Ignore everything but the "debian" toplevel directory::
2634
2642
 
2635
2643
            bzr ignore "RE:(?!debian/).*"
 
2644
        
 
2645
        Ignore everything except the "local" toplevel directory,
 
2646
        but always ignore "*~" autosave files, even under local/::
 
2647
        
 
2648
            bzr ignore "*"
 
2649
            bzr ignore "!./local"
 
2650
            bzr ignore "!!*~"
2636
2651
    """
2637
2652
 
2638
2653
    _see_also = ['status', 'ignored', 'patterns']
3647
3662
    committed to record the result of the merge.
3648
3663
 
3649
3664
    merge refuses to run if there are any uncommitted changes, unless
3650
 
    --force is given.
 
3665
    --force is given. The --force option can also be used to create a
 
3666
    merge revision which has more than two parents.
 
3667
 
 
3668
    If one would like to merge changes from the working tree of the other
 
3669
    branch without merging any committed revisions, the --uncommitted option
 
3670
    can be given.
3651
3671
 
3652
3672
    To select only some changes to merge, use "merge -i", which will prompt
3653
3673
    you to apply each diff hunk and file change, similar to "shelve".
3668
3688
        To apply a merge directive contained in /tmp/merge::
3669
3689
 
3670
3690
            bzr merge /tmp/merge
 
3691
 
 
3692
        To create a merge revision with three parents from two branches
 
3693
        feature1a and feature1b:
 
3694
 
 
3695
            bzr merge ../feature1a
 
3696
            bzr merge ../feature1b --force
 
3697
            bzr commit -m 'revision with three parents'
3671
3698
    """
3672
3699
 
3673
3700
    encoding_type = 'exact'
4080
4107
    created as above.  Directories containing unknown files will not be
4081
4108
    deleted.
4082
4109
 
4083
 
    The working tree contains a list of pending merged revisions, which will
4084
 
    be included as parents in the next commit.  Normally, revert clears that
4085
 
    list as well as reverting the files.  If any files are specified, revert
4086
 
    leaves the pending merge list alone and reverts only the files.  Use "bzr
4087
 
    revert ." in the tree root to revert all files but keep the merge record,
4088
 
    and "bzr revert --forget-merges" to clear the pending merge list without
 
4110
    The working tree contains a list of revisions that have been merged but
 
4111
    not yet committed. These revisions will be included as additional parents
 
4112
    of the next commit.  Normally, using revert clears that list as well as
 
4113
    reverting the files.  If any files are specified, revert leaves the list
 
4114
    of uncommitted merges alone and reverts only the files.  Use ``bzr revert
 
4115
    .`` in the tree root to revert all files but keep the recorded merges,
 
4116
    and ``bzr revert --forget-merges`` to clear the pending merge list without
4089
4117
    reverting any files.
4090
4118
 
4091
 
    Using "bzr revert --forget-merges", it is possible to apply the changes
4092
 
    from an arbitrary merge as a single revision.  To do this, perform the
4093
 
    merge as desired.  Then doing revert with the "--forget-merges" option will
4094
 
    keep the content of the tree as it was, but it will clear the list of
4095
 
    pending merges.  The next commit will then contain all of the changes that
4096
 
    would have been in the merge, but without any mention of the other parent
4097
 
    revisions.  Because this technique forgets where these changes originated,
4098
 
    it may cause additional conflicts on later merges involving the source and
 
4119
    Using "bzr revert --forget-merges", it is possible to apply all of the
 
4120
    changes from a branch in a single revision.  To do this, perform the merge
 
4121
    as desired.  Then doing revert with the "--forget-merges" option will keep
 
4122
    the content of the tree as it was, but it will clear the list of pending
 
4123
    merges.  The next commit will then contain all of the changes that are
 
4124
    present in the other branch, but without any other parent revisions.
 
4125
    Because this technique forgets where these changes originated, it may
 
4126
    cause additional conflicts on later merges involving the same source and
4099
4127
    target branches.
4100
4128
    """
4101
4129
 
4370
4398
    adding new commands, providing additional network transports and
4371
4399
    customizing log output.
4372
4400
 
4373
 
    See the Bazaar web site, http://bazaar-vcs.org, for further
4374
 
    information on plugins including where to find them and how to
4375
 
    install them. Instructions are also provided there on how to
4376
 
    write new plugins using the Python programming language.
 
4401
    See the Bazaar Plugin Guide <http://doc.bazaar.canonical.com/plugins/en/>
 
4402
    for further information on plugins including where to find them and how to
 
4403
    install them. Instructions are also provided there on how to write new
 
4404
    plugins using the Python programming language.
4377
4405
    """
4378
4406
    takes_options = ['verbose']
4379
4407
 
4577
4605
                    'This format does not remember old locations.')
4578
4606
            else:
4579
4607
                if location is None:
4580
 
                    raise errors.BzrCommandError('No location supplied and no '
4581
 
                        'previous location known')
 
4608
                    if b.get_bound_location() is not None:
 
4609
                        raise errors.BzrCommandError('Branch is already bound')
 
4610
                    else:
 
4611
                        raise errors.BzrCommandError('No location supplied '
 
4612
                            'and no previous location known')
4582
4613
        b_other = Branch.open(location)
4583
4614
        try:
4584
4615
            b.bind(b_other)
4721
4752
    CAUTION: Locks should only be broken when you are sure that the process
4722
4753
    holding the lock has been stopped.
4723
4754
 
4724
 
    You can get information on what locks are open via the 'bzr info' command.
 
4755
    You can get information on what locks are open via the 'bzr info
 
4756
    [location]' command.
4725
4757
 
4726
4758
    :Examples:
4727
4759
        bzr break-lock
 
4760
        bzr break-lock bzr+ssh://example.com/bzr/foo
4728
4761
    """
4729
4762
    takes_args = ['location?']
4730
4763
 
5428
5461
    that of the master.
5429
5462
    """
5430
5463
 
5431
 
    takes_args = ['to_location']
 
5464
    takes_args = ['to_location?']
5432
5465
    takes_options = [Option('force',
5433
5466
                        help='Switch even if local commits will be lost.'),
 
5467
                     'revision',
5434
5468
                     Option('create-branch', short_name='b',
5435
5469
                        help='Create the target branch from this one before'
5436
5470
                             ' switching to it.'),
5437
 
                     ]
 
5471
                    ]
5438
5472
 
5439
 
    def run(self, to_location, force=False, create_branch=False):
 
5473
    def run(self, to_location=None, force=False, create_branch=False,
 
5474
            revision=None):
5440
5475
        from bzrlib import switch
5441
5476
        tree_location = '.'
 
5477
        revision = _get_one_revision('switch', revision)
5442
5478
        control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
 
5479
        if to_location is None:
 
5480
            if revision is None:
 
5481
                raise errors.BzrCommandError('You must supply either a'
 
5482
                                             ' revision or a location')
 
5483
            to_location = '.'
5443
5484
        try:
5444
5485
            branch = control_dir.open_branch()
5445
5486
            had_explicit_nick = branch.get_config().has_explicit_nickname()
5459
5500
            to_branch = branch.bzrdir.sprout(to_location,
5460
5501
                                 possible_transports=[branch.bzrdir.root_transport],
5461
5502
                                 source_branch=branch).open_branch()
5462
 
            # try:
5463
 
            #     from_branch = control_dir.open_branch()
5464
 
            # except errors.NotBranchError:
5465
 
            #     raise BzrCommandError('Cannot create a branch from this'
5466
 
            #         ' location when we cannot open this branch')
5467
 
            # from_branch.bzrdir.sprout(
5468
 
            pass
5469
5503
        else:
5470
5504
            try:
5471
5505
                to_branch = Branch.open(to_location)
5473
5507
                this_url = self._get_branch_location(control_dir)
5474
5508
                to_branch = Branch.open(
5475
5509
                    urlutils.join(this_url, '..', to_location))
5476
 
        switch.switch(control_dir, to_branch, force)
 
5510
        if revision is not None:
 
5511
            revision = revision.as_revision_id(to_branch)
 
5512
        switch.switch(control_dir, to_branch, force, revision_id=revision)
5477
5513
        if had_explicit_nick:
5478
5514
            branch = control_dir.open_branch() #get the new branch!
5479
5515
            branch.nick = to_branch.nick