/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-07-30 19:08:15 UTC
  • Revision ID: tim@ed.am-20140730190815-f3fs5cgtwb88jbvb
added checks to not die when information is missing in deployment

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from command import Command
24
24
import stdhome.the as the
25
25
from stdhome.deployment import Deployment
26
 
from stdhome.subprocess import Popen
27
26
 
28
27
 
29
28
class InitCommand( Command ):
69
68
                # URL argument
70
69
                self.url = args[ 0 ].strip() if len( args ) else None
71
70
 
72
 
                # remaining arguments
 
71
                # check remaining arguments
73
72
                if len( args ) > 1:
74
73
                        raise the.program.UsageError( 'too many arguments' )
75
74
 
88
87
 
89
88
                        # expand url if it's a simple hostname
90
89
                        if re.match( '^[0-9a-zA-z.]+$', self.url ):
91
 
                                self.url = 'sftp://%s/%s/%s' % \
 
90
                                self.url = 'bzr+ssh://%s/%s/%s' % \
92
91
                                                   ( self.url, the.dir, the.repo.name )
93
92
 
94
93
                        # initialise deployment (with an empty repo)
96
95
                        deployment.copy_in()
97
96
 
98
97
                        # perform bzr checkout
99
 
                        if the.verbose: print "checking out %s" % the.repo.dir
 
98
                        if the.verbose >= 1: print "checking out %s" % the.repo.dir
100
99
                        try:
101
100
                                the.repo.vcs.checkout( self.url )
102
101
                        except Exception as e:
118
117
                else:
119
118
 
120
119
                        # perform bzr init
121
 
                        if the.verbose: print 'initialising %s' % the.repo.dir
 
120
                        if the.verbose >= 1: print 'initialising %s' % the.repo.dir
122
121
                        try:
123
122
                                the.repo.vcs.init()
124
123
                        except Exception as e: