Package moap :: Package command :: Module ignore
[hide private]
[frames] | no frames]

Source Code for Module moap.command.ignore

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3   
 4  import os 
 5  import sys 
 6   
 7  from moap.util import util 
 8   
 9  from moap.vcs import vcs 
10   
11 -class Ignore(util.LogCommand):
12 usage = "ignore [ignore-options] [path to source]" 13 summary = "update VCS ignore list" 14 description = """Updates the list of files the VCS should ignore. 15 Supported VCS systems: %s""" % ", ".join(vcs.getNames()) 16
17 - def addOptions(self):
18 self.parser.add_option('-l', '--list', 19 action="store_true", dest="list", 20 help="only list unignored files") 21 self.parser.add_option('-n', '--no-commit', 22 action="store_true", dest="noCommit", 23 help="do not commit to repository")
24 25
26 - def handleOptions(self, options):
27 self.options = options
28
29 - def do(self, args):
30 path = os.getcwd() 31 if args: 32 path = args[0] 33 34 v = vcs.detect(path) 35 if not v: 36 sys.stderr.write('No VCS detected in %s\n' % path) 37 return 3 38 39 paths = v.getNotIgnored() 40 if not paths: 41 print "No unignored files." 42 return 0 43 44 if self.options.list: 45 print "Unignored files:\n" 46 for p in paths: print p 47 return 0 48 49 result = util.editTemp(paths, [ 50 'Remove all the files that should not be ignored.', 51 'Glob-style lines are allowed.' 52 ]) 53 54 v.ignore(result, not self.options.noCommit)
55