~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: 2010-10-12 10:43:30 UTC
  • mfrom: (5487.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101012104330-tsonnndvloj18v4q
(vila) Add a --no-tree option for init and push (Matthew Gordon)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1069
1069
        Option('strict',
1070
1070
               help='Refuse to push if there are uncommitted changes in'
1071
1071
               ' the working tree, --no-strict disables the check.'),
 
1072
        Option('no-tree',
 
1073
               help="Don't populate the working tree, even for protocols"
 
1074
               " that support it."),
1072
1075
        ]
1073
1076
    takes_args = ['location?']
1074
1077
    encoding_type = 'replace'
1076
1079
    def run(self, location=None, remember=False, overwrite=False,
1077
1080
        create_prefix=False, verbose=False, revision=None,
1078
1081
        use_existing_dir=False, directory=None, stacked_on=None,
1079
 
        stacked=False, strict=None):
 
1082
        stacked=False, strict=None, no_tree=False):
1080
1083
        from bzrlib.push import _show_push_branch
1081
1084
 
1082
1085
        if directory is None:
1128
1131
        _show_push_branch(br_from, revision_id, location, self.outf,
1129
1132
            verbose=verbose, overwrite=overwrite, remember=remember,
1130
1133
            stacked_on=stacked_on, create_prefix=create_prefix,
1131
 
            use_existing_dir=use_existing_dir)
 
1134
            use_existing_dir=use_existing_dir, no_tree=no_tree)
1132
1135
 
1133
1136
 
1134
1137
class cmd_branch(Command):
1712
1715
                ),
1713
1716
         Option('append-revisions-only',
1714
1717
                help='Never change revnos or the existing log.'
1715
 
                '  Append revisions to it only.')
 
1718
                '  Append revisions to it only.'),
 
1719
         Option('no-tree',
 
1720
                'Create a branch without a working tree.')
1716
1721
         ]
1717
1722
    def run(self, location=None, format=None, append_revisions_only=False,
1718
 
            create_prefix=False):
 
1723
            create_prefix=False, no_tree=False):
1719
1724
        if format is None:
1720
1725
            format = bzrdir.format_registry.make_bzrdir('default')
1721
1726
        if location is None:
1744
1749
        except errors.NotBranchError:
1745
1750
            # really a NotBzrDir error...
1746
1751
            create_branch = bzrdir.BzrDir.create_branch_convenience
 
1752
            if no_tree:
 
1753
                force_new_tree = False
 
1754
            else:
 
1755
                force_new_tree = None
1747
1756
            branch = create_branch(to_transport.base, format=format,
1748
 
                                   possible_transports=[to_transport])
 
1757
                                   possible_transports=[to_transport],
 
1758
                                   force_new_tree=force_new_tree)
1749
1759
            a_bzrdir = branch.bzrdir
1750
1760
        else:
1751
1761
            from bzrlib.transport.local import LocalTransport
1755
1765
                        raise errors.BranchExistsWithoutWorkingTree(location)
1756
1766
                raise errors.AlreadyBranchError(location)
1757
1767
            branch = a_bzrdir.create_branch()
1758
 
            a_bzrdir.create_workingtree()
 
1768
            if not no_tree:
 
1769
                a_bzrdir.create_workingtree()
1759
1770
        if append_revisions_only:
1760
1771
            try:
1761
1772
                branch.set_append_revisions_only(True)