~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2006-04-13 08:57:24 UTC
  • mto: This revision was merged to the branch mainline in revision 1660.
  • Revision ID: robertc@robertcollins.net-20060413085724-c7a3bdbaed2f8bc8
Teach `bzr init` how to init at the root of a repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
893
893
            # locations if the user supplies an extended path
894
894
            if not os.path.exists(location):
895
895
                os.mkdir(location)
896
 
        bzrdir.BzrDir.create_branch_convenience(location, format=format)
 
896
        try:
 
897
            existing = bzrdir.BzrDir.open(location)
 
898
        except NotBranchError:
 
899
            bzrdir.BzrDir.create_branch_convenience(location, format=format)
 
900
        else:
 
901
            try:
 
902
                existing.open_branch()
 
903
            except NotBranchError:
 
904
                existing.create_branch()
 
905
                existing.create_workingtree()
 
906
            else:
 
907
                raise errors.AlreadyBranchError(location)
897
908
 
898
909
 
899
910
class cmd_init_repository(Command):