/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-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

86
86
                deployment = Deployment()
87
87
                deployment.check_ongoing( True )
88
88
 
89
 
                # check for conflicts
90
89
                message = ''
91
 
                conflicts = the.repo.vcs.has_conflicts()
92
 
                if conflicts:
 
90
 
 
91
                # check for conflicts in repo
 
92
                files = the.repo.vcs.get_conflicts()
 
93
                if files:
93
94
                        message += 'Conflicts in %s:\n  %s' % \
94
 
                                           ( the.repo.name, '\n  '.join( conflicts ) )
95
 
                conflicts = deployment.check_conflicts()
 
95
                                           ( the.repo.name, '\n  '.join( files ) )
 
96
 
 
97
                # check for deployment conclicts
 
98
                conflicts = deployment.get_conflicts()
96
99
                if conflicts:
97
100
                        message += 'Deployment conflicts:\n  %s' % \
98
101
                                           '\n  '.join( conflicts )
 
102
 
 
103
                # stop if there are conflicts
99
104
                if message:
100
 
                        raise the.program.FatalError( 'there are conflicts:\n' + message )
 
105
                        raise the.program.FatalError(
 
106
                                'there were conflicts...\n' + message )
101
107
 
102
108
                # copy-out changes from repo
103
 
                try:
104
 
                        deployment.copy_out()
105
 
                except deployment.Conflict as e:
106
 
                        raise the.program.FatalError( e.msg )
 
109
                deployment.copy_out()
107
110
 
108
111
                # now we've copied-out, revert any copied-in changes!
109
112
                if the.verbose: print "reverting %s" % the.repo.dir