/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-09-09 19:13:33 UTC
  • Revision ID: tim@ed.am-20140909191333-0b7hrzonxce8mgy3
attempt to allow arguments before main command by treating the first thing that
doesn't look like an option as the command

Show diffs side-by-side

added added

removed removed

71
71
                                        raise the.program.FatalError(
72
72
                                                'invalid repository name: ' + optarg )
73
73
                                the.repo = optarg
 
74
                        elif opt in [ '--verbose', '-v' ]:
 
75
                                the.verbose += 1
74
76
                        elif opt == "--help":
75
77
                                self.print_help()
76
 
 
 
78
                
77
79
                # discard first argument (the command)
78
80
                args.pop( 0 )
79
81
 
95
97
                if the.repo.vcs.has_changes():
96
98
                        raise the.program.FatalError(
97
99
                                'repo has local changes: %s\n'
98
 
                                'Hint: see "%s stage-revert --help"' %
 
100
                                'Hint: see "%s stage-revert --help"' % 
99
101
                                ( the.repo.name, the.program.name ) )
100
102
 
101
103
                # copy-in changes to repo
102
 
                deployment.copy_in()
 
104
                try:
 
105
                        deployment.copy_in()
 
106
                except deployment.CopyInConflicts as e:
 
107
                        raise the.program.FatalError(
 
108
                                'Files in %s differ too severly from %s:\n  %s\n' % \
 
109
                                ( the.home_dir, the.repo.dir, '\n  '.join( e.conflicts ) ) )
103
110
 
104
111
                # perform vcs update
105
112
                if the.verbose >= 1: print "updating %s" % the.repo.dir
123
130
                if message:
124
131
                        raise the.program.FatalError(
125
132
                                'there were conflicts...\n' + message )
126
 
 
127
133
                # copy-out changes from repo
128
134
                deployment.copy_out()
129
135