/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/command/init.py

  • Committer: Tim Marston
  • Date: 2014-03-19 20:02:10 UTC
  • Revision ID: tim@ed.am-20140319200210-b6nm63rpktfmw0l3
changed working of output

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
class InitCommand( Command ):
30
30
 
31
31
 
 
32
        def __init__( self ):
 
33
                self.repo = None
 
34
 
 
35
 
32
36
        def print_help( self ):
33
37
                print "Usage: " + the.program.name + " init [URL] [--repo=REPO]"
34
38
                print
57
61
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
58
62
                                        raise the.program.FatalError(
59
63
                                                'invalid repository name: ' + optarg )
60
 
                                the.repo = optarg
 
64
                                self.repo = optarg
61
65
                        elif opt in [ '--verbose', '-v' ]:
62
66
                                the.verbose += 1
63
67
                        elif opt == "--help":
69
73
                # URL argument
70
74
                self.url = args[ 0 ].strip() if len( args ) else None
71
75
 
72
 
                # check remaining arguments
 
76
                # remaining arguments
73
77
                if len( args ) > 1:
74
78
                        raise the.program.UsageError( 'too many arguments' )
75
79
 
77
81
        def run( self ):
78
82
 
79
83
                # set up repo and check it *doesn't* already exists
 
84
                the.set_repo( self.repo )
80
85
                the.repo.check_dir_exists( False )
81
86
 
82
87
                # ensure our top-level directory exists
96
101
                        deployment.copy_in()
97
102
 
98
103
                        # perform bzr checkout
99
 
                        if the.verbose >= 1: print "checking out %s" % the.repo.dir
 
104
                        if the.verbose: print "checking out %s" % the.repo.dir
100
105
                        try:
101
106
                                the.repo.vcs.checkout( self.url )
102
107
                        except Exception as e:
118
123
                else:
119
124
 
120
125
                        # perform bzr init
121
 
                        if the.verbose >= 1: print 'initialising %s' % the.repo.dir
 
126
                        if the.verbose: print 'initialising %s' % the.repo.dir
122
127
                        try:
123
128
                                the.repo.vcs.init()
124
129
                        except Exception as e: