/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-03-08 00:47:23 UTC
  • Revision ID: tim@ed.am-20140308004723-hkl3s2hobsblf72o
added diff command; moved all command to commands subdir; made stage-revert
handle ongoing deployment automatically (now that initial revno is known); made
verbose level incremental; detect obstructing conflicts in ConflictWalker;
handle files deleted from repo during copy-out (update)

Show diffs side-by-side

added added

removed removed

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