From e29b227b5bb951c516b3d17d2fdda5b5bad2af16 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Wed, 11 Aug 2010 18:05:12 +0200 Subject: [PATCH] - 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 --- osc/commandline.py | 7 +++++-- osc/core.py | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index fde57c4e..7de10260 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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) diff --git a/osc/core.py b/osc/core.py index 9fabba89..c8f1a642 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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