~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2007-02-13 19:22:47 UTC
  • mto: (2230.3.47 branch6)
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: abentley@panoramicfeedback.com-20070213192247-3p6173awqxcd7nae
add --append-revisions-only option to init

Show diffs side-by-side

added added

removed removed

Lines of Context:
1194
1194
                value_switches=True,
1195
1195
                title="Branch Format",
1196
1196
                ),
 
1197
         Option('append-revisions-only',
 
1198
                help='Never change revnos or the existing log.'
 
1199
                '  Append revisions to it only.')
1197
1200
         ]
1198
 
    def run(self, location=None, format=None):
 
1201
    def run(self, location=None, format=None, append_revisions_only=False):
1199
1202
        if format is None:
1200
1203
            format = bzrdir.format_registry.make_bzrdir('default')
1201
1204
        if location is None:
1218
1221
            existing_bzrdir = bzrdir.BzrDir.open(location)
1219
1222
        except errors.NotBranchError:
1220
1223
            # really a NotBzrDir error...
1221
 
            bzrdir.BzrDir.create_branch_convenience(location, format=format)
 
1224
            branch = bzrdir.BzrDir.create_branch_convenience(location,
 
1225
                                                             format=format)
1222
1226
        else:
1223
1227
            from bzrlib.transport.local import LocalTransport
1224
1228
            if existing_bzrdir.has_branch():
1227
1231
                        raise errors.BranchExistsWithoutWorkingTree(location)
1228
1232
                raise errors.AlreadyBranchError(location)
1229
1233
            else:
1230
 
                existing_bzrdir.create_branch()
 
1234
                branch = existing_bzrdir.create_branch()
1231
1235
                existing_bzrdir.create_workingtree()
 
1236
        if append_revisions_only:
 
1237
            try:
 
1238
                branch.set_append_revisions_only(True)
 
1239
            except errors.UpgradeRequired:
 
1240
                raise errors.BzrCommandError('This branch format cannot be set'
 
1241
                    ' to append-revisions-only.  Try --experimental-branch6')
1232
1242
 
1233
1243
 
1234
1244
class cmd_init_repository(Command):