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

  • Committer: Tim Marston
  • Date: 2014-02-26 19:10:31 UTC
  • Revision ID: tim@ed.am-20140226191031-elcqy5j09h2syn2j
moved copy-in, copy-out and deployment conflict checking to a set of "walkers";
bzr vcs back-end now parses affected files during update; deployment state now
includes affected files

Show diffs side-by-side

added added

removed removed

29
29
 
30
30
        def __init__( self ):
31
31
                self.repo = None
 
32
                self.force = False
32
33
 
33
34
 
34
35
        def print_help( self ):
48
49
                print "repository."
49
50
                print
50
51
                print "Options:"
 
52
                print "      --force      disregard any ongoing deployment"
51
53
                print "  -r, --repo=REPO  select the repo to check-out or create (defaults to 'home')"
52
54
                print "  -v, --verbose    display information about what is being done"
53
55
                print "      --help       display help and exit"
57
59
        def parse_command_line( self ):
58
60
                opts, args = getopt.gnu_getopt(
59
61
                        sys.argv[ 1: ], "r:v",
60
 
                        [ "repo=", "verbose", "help" ] )
 
62
                        [ "force", "repo=", "verbose", "help" ] )
61
63
                for opt, optarg in opts:
 
64
                        if opt == '--force':
 
65
                                self.force = True
62
66
                        if opt in [ '--repo', '-r' ]:
63
67
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
64
68
                                        raise the.program.FatalError(
85
89
 
86
90
                # check there isn't a deployment in progress
87
91
                deployment = Deployment()
88
 
                deployment.check_ongoing( False )
 
92
                if not self.force:
 
93
                        deployment.check_ongoing( False )
89
94
 
90
95
                # check for local changes
91
96
                if the.verbose: print "reverting %s" % the.repo.dir
92
97
                the.repo.vcs.revert()
 
98
 
 
99
                # remove deployment state, as necessary
 
100
                if self.force:
 
101
                        deployment.remove_deployment_state()