/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/resolve.py

  • Committer: Tim Marston
  • Date: 2014-09-09 19:13:33 UTC
  • Revision ID: tim@ed.am-20140909191333-0b7hrzonxce8mgy3
attempt to allow arguments before main command by treating the first thing that
doesn't look like an option as the command

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
class ResolveCommand( Command ):
29
29
 
30
30
 
31
 
        def __init__( self ):
32
 
                self.repo = None
33
 
 
34
 
 
35
31
        def print_help( self ):
36
32
                print "Usage: " + the.program.name + " resolve [--repo=REPO]"
37
33
                print
63
59
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
64
60
                                        raise the.program.FatalError(
65
61
                                                'invalid repository name: ' + optarg )
66
 
                                self.repo = optarg
 
62
                                the.repo = optarg
67
63
                        elif opt in [ '--verbose', '-v' ]:
68
64
                                the.verbose += 1
69
65
                        elif opt == "--help":
80
76
        def run( self ):
81
77
 
82
78
                # set up repo and check it exists
83
 
                the.set_repo( self.repo )
84
79
                the.repo.check_dir_exists()
85
80
 
86
81
                # initialise deployment (check it's valid)
92
87
                # check for conflicts in repo
93
88
                files = the.repo.vcs.get_conflicts()
94
89
                if files:
95
 
                        message += 'Conflicts in %s:\n  %s' % \
 
90
                        message += 'conflicts in %s:\n  %s' % \
96
91
                                           ( the.repo.name, '\n  '.join( files ) )
97
92
 
98
93
                # check for deployment conclicts
99
94
                conflicts = deployment.get_conflicts()
100
95
                if conflicts:
101
 
                        message += 'Deployment conflicts:\n  %s' % \
 
96
                        message += 'deployment conflicts:\n  %s' % \
102
97
                                           '\n  '.join( conflicts )
103
98
 
104
99
                # stop if there are conflicts
110
105
                deployment.copy_out()
111
106
 
112
107
                # now we've copied-out, revert any copied-in changes!
113
 
                if the.verbose: print "reverting %s" % the.repo.dir
 
108
                if the.verbose >= 1: print "reverting %s" % the.repo.dir
114
109
                the.repo.vcs.revert()