1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 22:56:15 +01:00

- do_status: added '--show-excluded' option to show all files (except the store dir)

Additionally "osc st" doesn't show dirs anymore if it's called from
a package wc because dirs cannot be added to a package
This commit is contained in:
Marcus Huewe 2010-08-11 18:05:12 +02:00
parent ba4b0d3c20
commit e29b227b5b
2 changed files with 19 additions and 10 deletions

View File

@ -2691,6 +2691,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='print as little as possible')
@cmdln.option('-v', '--verbose', action='store_true',
help='print extra information')
@cmdln.option('-e', '--show-excluded', action='store_true',
help='also show files which are excluded by the ' \
'"exclude_glob" config option')
@cmdln.alias('st')
def do_status(self, subcmd, opts, *args):
"""${cmd_name}: Show status of files in working copy
@ -2747,10 +2750,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.NoWorkingCopy, msg
lines = []
# process single packages
lines = getStatus(findpacs(pacpaths), None, opts.verbose, opts.quiet)
lines = getStatus(findpacs(pacpaths), None, opts.verbose, opts.quiet, opts.show_excluded)
# process project dirs
for prj, pacs in prjpacs.iteritems():
lines += getStatus(findpacs(pacs), prj, opts.verbose, opts.quiet)
lines += getStatus(findpacs(pacs), prj, opts.verbose, opts.quiet, opts.show_excluded)
if lines:
print '\n'.join(lines)

View File

@ -1159,9 +1159,12 @@ class Package:
self.meta = self.ismetamode()
# gather unversioned files, but ignore some stuff
self.excluded = [ i for i in os.listdir(self.dir)
for j in conf.config['exclude_glob']
if fnmatch.fnmatch(i, j) ]
self.excluded = []
for i in os.listdir(self.dir):
for j in conf.config['exclude_glob']:
if fnmatch.fnmatch(i, j):
self.excluded.append(i)
break
self.filenamelist_unvers = [ i for i in os.listdir(self.dir)
if i not in self.excluded
if i not in self.filenamelist ]
@ -4934,7 +4937,7 @@ def getTransActPath(pac_dir):
pathn = ''
return pathn
def getStatus(pacs, prj_obj=None, verbose=False, quiet=False):
def getStatus(pacs, prj_obj=None, verbose=False, quiet=False, excluded=False):
"""
calculates the status of certain packages. pacs is a list of Package()
objects and prj_obj is a Project() object. If prj_obj is specified all
@ -4952,9 +4955,12 @@ def getStatus(pacs, prj_obj=None, verbose=False, quiet=False):
lines.append(statfrmt('!', os.path.normpath(os.path.join(prj_obj.dir, data))))
for p in pacs:
# no files given as argument? Take all files in current dir
if not p.todo:
p.todo = p.filenamelist + p.filenamelist_unvers
if not p.todo and excluded:
# all files + dirs in pwd (except .osc storedir)
p.todo = p.filenamelist + p.filenamelist_unvers + [i for i in p.excluded if i != store]
elif not p.todo:
# only files, no dirs and no excluded files
p.todo = p.filenamelist + [i for i in p.filenamelist_unvers if not os.path.isdir(i)]
p.todo.sort()
if prj_obj and conf.config['do_package_tracking']:
@ -4965,7 +4971,7 @@ def getStatus(pacs, prj_obj=None, verbose=False, quiet=False):
for filename in p.todo:
if filename.startswith('_service:'):
continue
if filename in p.excluded:
if filename in p.excluded and not excluded:
continue
if filename in p.skipped:
continue