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

  • Committer: Tim Marston
  • Date: 2014-02-26 19:15:30 UTC
  • Revision ID: tim@ed.am-20140226191530-6x21vlwto2xx80cd
renamed updated_files to affected_files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# update.py
 
1
# command_update.py
2
2
#
3
3
# Copyright (C) 2014 Tim Marston <tim@edm.am>
4
4
#
20
20
 
21
21
 
22
22
import sys, re, getopt
23
 
from command import Command
24
 
import stdhome.the as the
25
 
from stdhome.deployment import Deployment
26
 
 
27
 
 
28
 
class UpdateCommand( Command ):
 
23
import the
 
24
from deployment import Deployment
 
25
 
 
26
 
 
27
class CommandUpdate:
29
28
 
30
29
 
31
30
        def __init__( self ):
72
71
                                                'invalid repository name: ' + optarg )
73
72
                                self.repo = optarg
74
73
                        elif opt in [ '--verbose', '-v' ]:
75
 
                                the.verbose += 1
 
74
                                the.verbose = True
76
75
                        elif opt == "--help":
77
76
                                self.print_help()
78
77
                
90
89
                the.set_repo( self.repo )
91
90
                the.repo.check_dir_exists()
92
91
 
93
 
                # initialise deployment (and check it)
 
92
                # initialise deployment (check it's valid)
94
93
                deployment = Deployment()
95
94
                deployment.check_ongoing( False )
96
95
 
107
106
                except deployment.CopyInConflicts as e:
108
107
                        raise the.program.FatalError(
109
108
                                'Files in %s differ too severly from %s:\n  %s\n' % \
110
 
                                ( the.hdir, the.repo.dir, '\n  '.join( e.conflicts ) ) )
 
109
                                ( the.fsdir, the.repo.dir, '\n  '.join( e.conflicts ) ) )
111
110
 
112
111
                # perform vcs update
113
112
                if the.verbose: print "updating %s" % the.repo.dir
131
130
                if message:
132
131
                        raise the.program.FatalError(
133
132
                                'there were conflicts...\n' + message )
 
133
 
134
134
                # copy-out changes from repo
135
135
                deployment.copy_out()
136
136