mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 15:06: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:
parent
ba4b0d3c20
commit
e29b227b5b
@ -2691,6 +2691,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
help='print as little as possible')
|
help='print as little as possible')
|
||||||
@cmdln.option('-v', '--verbose', action='store_true',
|
@cmdln.option('-v', '--verbose', action='store_true',
|
||||||
help='print extra information')
|
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')
|
@cmdln.alias('st')
|
||||||
def do_status(self, subcmd, opts, *args):
|
def do_status(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Show status of files in working copy
|
"""${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
|
raise oscerr.NoWorkingCopy, msg
|
||||||
lines = []
|
lines = []
|
||||||
# process single packages
|
# 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
|
# process project dirs
|
||||||
for prj, pacs in prjpacs.iteritems():
|
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:
|
if lines:
|
||||||
print '\n'.join(lines)
|
print '\n'.join(lines)
|
||||||
|
|
||||||
|
22
osc/core.py
22
osc/core.py
@ -1159,9 +1159,12 @@ class Package:
|
|||||||
self.meta = self.ismetamode()
|
self.meta = self.ismetamode()
|
||||||
|
|
||||||
# gather unversioned files, but ignore some stuff
|
# gather unversioned files, but ignore some stuff
|
||||||
self.excluded = [ i for i in os.listdir(self.dir)
|
self.excluded = []
|
||||||
for j in conf.config['exclude_glob']
|
for i in os.listdir(self.dir):
|
||||||
if fnmatch.fnmatch(i, j) ]
|
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)
|
self.filenamelist_unvers = [ i for i in os.listdir(self.dir)
|
||||||
if i not in self.excluded
|
if i not in self.excluded
|
||||||
if i not in self.filenamelist ]
|
if i not in self.filenamelist ]
|
||||||
@ -4934,7 +4937,7 @@ def getTransActPath(pac_dir):
|
|||||||
pathn = ''
|
pathn = ''
|
||||||
return 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()
|
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
|
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))))
|
lines.append(statfrmt('!', os.path.normpath(os.path.join(prj_obj.dir, data))))
|
||||||
|
|
||||||
for p in pacs:
|
for p in pacs:
|
||||||
# no files given as argument? Take all files in current dir
|
if not p.todo and excluded:
|
||||||
if not p.todo:
|
# all files + dirs in pwd (except .osc storedir)
|
||||||
p.todo = p.filenamelist + p.filenamelist_unvers
|
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()
|
p.todo.sort()
|
||||||
|
|
||||||
if prj_obj and conf.config['do_package_tracking']:
|
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:
|
for filename in p.todo:
|
||||||
if filename.startswith('_service:'):
|
if filename.startswith('_service:'):
|
||||||
continue
|
continue
|
||||||
if filename in p.excluded:
|
if filename in p.excluded and not excluded:
|
||||||
continue
|
continue
|
||||||
if filename in p.skipped:
|
if filename in p.skipped:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user