/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-04-18 15:00:34 UTC
  • Revision ID: tim@ed.am-20140418150034-l94wfs6ururhi9t5
fixed error in walker.py (from last checkin)

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