/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: Andrew Bennetts
  • Date: 2010-03-26 04:47:45 UTC
  • mfrom: (5116 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5117.
  • Revision ID: andrew.bennetts@canonical.com-20100326044745-ubvt5tmse1a17s1f
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2438
2438
            raise errors.BzrCommandError(
2439
2439
                "bzr %s doesn't accept two revisions in different"
2440
2440
                " branches." % command_name)
2441
 
        rev1 = start_spec.in_history(branch)
 
2441
        if start_spec.spec is None:
 
2442
            # Avoid loading all the history.
 
2443
            rev1 = RevisionInfo(branch, None, None)
 
2444
        else:
 
2445
            rev1 = start_spec.in_history(branch)
2442
2446
        # Avoid loading all of history when we know a missing
2443
2447
        # end of range means the last revision ...
2444
2448
        if end_spec.spec is None:
5264
5268
 
5265
5269
    To rename a tag (change the name but keep it on the same revsion), run ``bzr
5266
5270
    tag new-name -r tag:old-name`` and then ``bzr tag --delete oldname``.
 
5271
 
 
5272
    If no tag name is specified it will be determined through the 
 
5273
    'automatic_tag_name' hook. This can e.g. be used to automatically tag
 
5274
    upstream releases by reading configure.ac. See ``bzr help hooks`` for
 
5275
    details.
5267
5276
    """
5268
5277
 
5269
5278
    _see_also = ['commit', 'tags']
5270
 
    takes_args = ['tag_name']
 
5279
    takes_args = ['tag_name?']
5271
5280
    takes_options = [
5272
5281
        Option('delete',
5273
5282
            help='Delete this tag rather than placing it.',
5283
5292
        'revision',
5284
5293
        ]
5285
5294
 
5286
 
    def run(self, tag_name,
 
5295
    def run(self, tag_name=None,
5287
5296
            delete=None,
5288
5297
            directory='.',
5289
5298
            force=None,
5293
5302
        branch.lock_write()
5294
5303
        self.add_cleanup(branch.unlock)
5295
5304
        if delete:
 
5305
            if tag_name is None:
 
5306
                raise errors.BzrCommandError("No tag specified to delete.")
5296
5307
            branch.tags.delete_tag(tag_name)
5297
5308
            self.outf.write('Deleted tag %s.\n' % tag_name)
5298
5309
        else:
5304
5315
                revision_id = revision[0].as_revision_id(branch)
5305
5316
            else:
5306
5317
                revision_id = branch.last_revision()
 
5318
            if tag_name is None:
 
5319
                tag_name = branch.automatic_tag_name(revision_id)
 
5320
                if tag_name is None:
 
5321
                    raise errors.BzrCommandError(
 
5322
                        "Please specify a tag name.")
5307
5323
            if (not force) and branch.tags.has_tag(tag_name):
5308
5324
                raise errors.TagAlreadyExists(tag_name)
5309
5325
            branch.tags.set_tag(tag_name, revision_id)
5745
5761
                    self.outf.write("    <no hooks installed>\n")
5746
5762
 
5747
5763
 
 
5764
class cmd_remove_branch(Command):
 
5765
    """Remove a branch.
 
5766
 
 
5767
    This will remove the branch from the specified location but 
 
5768
    will keep any working tree or repository in place.
 
5769
 
 
5770
    :Examples:
 
5771
 
 
5772
      Remove the branch at repo/trunk::
 
5773
 
 
5774
        bzr remove-branch repo/trunk
 
5775
 
 
5776
    """
 
5777
 
 
5778
    takes_args = ["location?"]
 
5779
 
 
5780
    aliases = ["rmbranch"]
 
5781
 
 
5782
    def run(self, location=None):
 
5783
        if location is None:
 
5784
            location = "."
 
5785
        branch = Branch.open_containing(location)[0]
 
5786
        branch.bzrdir.destroy_branch()
 
5787
        
 
5788
 
5748
5789
class cmd_shelve(Command):
5749
5790
    """Temporarily set aside some changes from the current tree.
5750
5791
 
5933
5974
            self.outf.write('%s %s\n' % (path, location))
5934
5975
 
5935
5976
 
5936
 
# these get imported and then picked up by the scan for cmd_*
5937
 
# TODO: Some more consistent way to split command definitions across files;
5938
 
# we do need to load at least some information about them to know of
5939
 
# aliases.  ideally we would avoid loading the implementation until the
5940
 
# details were needed.
5941
5977
from bzrlib.cmd_version_info import cmd_version_info
5942
5978
from bzrlib.conflicts import cmd_resolve, cmd_conflicts, restore
5943
 
from bzrlib.bundle.commands import (
5944
 
    cmd_bundle_info,
5945
 
    )
5946
5979
from bzrlib.foreign import cmd_dpush
5947
5980
from bzrlib.sign_my_commits import cmd_sign_my_commits