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

  • Committer: Tim Marston
  • Date: 2016-04-10 20:21:38 UTC
  • Revision ID: tim@ed.am-20160410202138-px3vd3r14889njtn
removed symlink previously committed

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
        def __init__( self ):
33
33
                self.all = False
 
34
                self.quiet = False
34
35
 
35
36
 
36
37
        def print_help( self ):
50
51
                print
51
52
                print "Options:"
52
53
                print "      --all        confirm that you want to revert all files"
 
54
                print "      --quiet      do not report changes to the home directory"
53
55
                print "  -r, --repo=REPO  select the repo to check-out or create (defaults to 'home')"
54
56
                print "  -v, --verbose    display information about what is being done"
55
57
                print "      --help       display help and exit"
59
61
        def parse_command_line( self ):
60
62
                opts, args = getopt.gnu_getopt(
61
63
                        sys.argv[ 1: ], "r:v",
62
 
                        [ "all", "repo=", "verbose", "help" ] )
 
64
                        [ "all", "quiet", "repo=", "verbose", "help" ] )
63
65
                for opt, optarg in opts:
64
66
                        if opt == "--all":
65
67
                                self.all = True
 
68
                        elif opt == "--quiet":
 
69
                                self.quiet = True
66
70
                        elif opt in [ '--repo', '-r' ]:
67
 
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
 
71
                                if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
68
72
                                        raise the.program.FatalError(
69
73
                                                'invalid repository name: ' + optarg )
70
74
                                the.repo = optarg
71
 
                        elif opt in [ '--verbose', '-v' ]:
 
75
                        elif opt in [ '-v', '--verbose' ]:
72
76
                                the.verbose += 1
73
77
                        elif opt == "--help":
74
78
                                self.print_help()
75
 
                
 
79
 
76
80
                # discard first argument (the command)
77
81
                args.pop( 0 )
78
82
 
104
108
                if the.repo.vcs.has_changes():
105
109
                        raise the.program.FatalError(
106
110
                                'repo has local changes: %s\n'
107
 
                                'Hint: see "%s stage-revert --help"' % 
 
111
                                'Hint: see "%s stage-revert --help"' %
108
112
                                ( the.repo.name, the.program.name ) )
109
113
 
110
114
                # check status
111
 
                walker = CopyOutWalker( files if files else None )
 
115
                walker = CopyOutWalker( files if files else None, self.quiet )
112
116
                walker.walk()