/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: 2016-02-13 13:20:44 UTC
  • Revision ID: tim@ed.am-20160213132044-t5zaxhdlhjyn4t1v
moved handling of --verbose to main program; manuall parse config file (because
ConfigFileParse does not support allow_no_value in python 2.6)

Show diffs side-by-side

added added

removed removed

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
67
 
                        elif opt in [ '--verbose', '-v' ]:
68
 
                                the.verbose += 1
 
62
                                the.repo = optarg
69
63
                        elif opt == "--help":
70
64
                                self.print_help()
71
 
                
 
65
 
72
66
                # discard first argument (the command)
73
67
                args.pop( 0 )
74
68
 
80
74
        def run( self ):
81
75
 
82
76
                # set up repo and check it exists
83
 
                the.set_repo( self.repo )
84
77
                the.repo.check_dir_exists()
85
78
 
86
79
                # initialise deployment (check it's valid)
92
85
                # check for conflicts in repo
93
86
                files = the.repo.vcs.get_conflicts()
94
87
                if files:
95
 
                        message += 'Conflicts in %s:\n  %s' % \
 
88
                        message += 'conflicts in %s:\n  %s' % \
96
89
                                           ( the.repo.name, '\n  '.join( files ) )
97
90
 
98
91
                # check for deployment conclicts
99
92
                conflicts = deployment.get_conflicts()
100
93
                if conflicts:
101
 
                        message += 'Deployment conflicts:\n  %s' % \
 
94
                        message += 'deployment conflicts:\n  %s' % \
102
95
                                           '\n  '.join( conflicts )
103
96
 
104
97
                # stop if there are conflicts
110
103
                deployment.copy_out()
111
104
 
112
105
                # now we've copied-out, revert any copied-in changes!
113
 
                if the.verbose: print "reverting %s" % the.repo.dir
 
106
                if the.verbose >= 1: print "reverting %s" % the.repo.dir
114
107
                the.repo.vcs.revert()