22
22
import sys, re, getopt
23
from .command import Command
23
from command import Command
24
24
import stdhome.the as the
25
25
from stdhome.deployment import Deployment
26
26
from stdhome.walker.status import StatusWalker
32
32
def print_help( self ):
33
print("Usage: " + the.program.name + " status [--repo=REPO] [FILE]...")
33
print "Usage: " + the.program.name + " status [--repo=REPO]"
35
35
# 01234567890123456789012345678901234567890123456789012345678901234567890123456789
36
print("Show the state of files in the local repository (including modifications and")
39
print("This lists files in your home directory that have been modified and which differ")
40
print("from those in the local repository. During an update that resulted in conflicts")
41
print("this also lists files which have conflicts in the local respository, or which")
42
print("can not be deployed due to conflicts with your home directory.")
44
print("For help with adding modified files to the repository, type:")
45
print(" " + the.program.name + " add --help")
48
print(" -r, --repo=REPO select the repo to check-out or create (defaults to 'home')")
49
print(" -v, --verbose display information about what is being done")
50
print(" --help display help and exit")
36
print "Show the state of files in the local repository (including modifications and"
39
print "This lists files in your home directory that have been modified and which differ"
40
print "from those in the local repository. During an update that resulted in conflicts"
41
print "this also lists files which have conflicts in the local respository, or which"
42
print "can not be deployed due to conflicts with your home directory."
44
print "For help with adding modified files to the repository, type:"
45
print " " + the.program.name + " add --help"
48
print " -r, --repo=REPO select the repo to check-out or create (defaults to 'home')"
49
print " -v, --verbose display information about what is being done"
50
print " --help display help and exit"
57
57
[ "repo=", "verbose", "help" ] )
58
58
for opt, optarg in opts:
59
59
if opt in [ '--repo', '-r' ]:
60
if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
60
if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
61
61
raise the.program.FatalError(
62
62
'invalid repository name: ' + optarg )
78
79
# set up repo and check it exists
79
80
the.repo.check_dir_exists()
82
files = self.expand_files( self.files )
86
84
# initialise deployment and check if it's ongoing
87
85
deployment = Deployment()
88
86
if deployment.is_ongoing():
89
print("deployment ongoing")
87
print "deployment ongoing"
91
89
# check for conflicts in repo
92
90
files = the.repo.vcs.get_conflicts()