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

  • Committer: Tim Marston
  • Date: 2014-07-30 19:07:14 UTC
  • Revision ID: tim@ed.am-20140730190714-si0k116f2px8wjxi
added --force command to stage-revert to override ongoing deployments that can
not be reverted (due to missing revo information)

Show diffs side-by-side

added added

removed removed

43
43
                """
44
44
 
45
45
                # list of files that were copied-in (or at least given the opportunity
46
 
                # to be) and updated through the vcs update.  This means that, while
47
 
                # there may have been conflicts during the update (which the user will
48
 
                # have to have dealt with in the repo), any conflicts arising with these
49
 
                # files in the home directory are no longer important and can be
50
 
                # ignored.  In short, this is a list of files that can safely be
51
 
                # deployed, regardless of the state of the home directory.
 
46
        # to be) and updated through the vcs update.  This means that, while
 
47
        # there may have been conflicts during the update (which the user will
 
48
        # have to have dealt with in the repo), any conflicts arising with these
 
49
        # files in the home directory are no longer important and can be
 
50
        # ignored.  In short, this is a list of files that can safely be
 
51
        # deployed, regardless of the state of the home directory.
52
52
                self.imported_files = None
53
53
 
54
54
                # list of files that were affected by a recent vcs update (so only these
72
72
                state = json.loads( f.read() )
73
73
 
74
74
                # unpack deployment state
75
 
                if 'imported_files' in state:
76
 
                        self.imported_files = state['imported_files'];
77
 
                if 'initial_revno' in state:
78
 
                        self.initial_revno = state['initial_revno'];
79
 
                if 'affected_files' in state:
80
 
                        self.affected_files = state['affected_files'];
 
75
                self.imported_files = state['imported_files'];
 
76
                self.initial_revno = state['initial_revno'];
 
77
                self.affected_files = state['affected_files'];
81
78
 
82
79
 
83
80
        def save_deployment_state( self ):
191
188
                return walker.changed + walker.obstructed
192
189
 
193
190
 
194
 
        def copy_out( self, quiet ):
 
191
        def copy_out( self ):
195
192
                """Copy-out changed files from the repository to the home directory.  If the
196
193
                deployment state includes a list of affected files, then only those
197
194
                files are copied-out.
206
203
 
207
204
                # copy out
208
205
                if the.verbose >= 1: print "exporting files..."
209
 
                walker = CopyOutWalker( self.affected_files, quiet )
 
206
                walker = CopyOutWalker( self.affected_files )
210
207
                walker.walk()
211
208
 
212
209
                # clear state
220
217
                                self.msg = "there is an ongoing deployment"
221
218
                        else:
222
219
                                self.msg = "there is no ongoing deployment"
 
220
 
 
221
 
 
222
        class CopyInConflicts( the.program.FatalError ):
 
223
 
 
224
                def __init__( self, conflicts ):
 
225
                        self.conflicts = conflicts