From 56d3b9b47909182d5b124cddb3229c038c507ef6 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Tue, 14 Sep 2010 14:40:18 +0200 Subject: [PATCH] - "do_repairwc": find all broken pkgs and repair them if it's called in a project dir --- osc/commandline.py | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 578da3a9..18379c8b 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -6002,18 +6002,31 @@ Please submit there instead, or use --nodevelproject to force direct submission. ${cmd_option_list} """ args = parseargs(args) - if len(args) < 1: - raise oscerr.WrongArgs('Too few arguments.') - elif len(args) > 1: - raise oscerr.WrongArgs('Too many arguments.') - try: - p = Package(args[0]) - except oscerr.WorkingCopyInconsistent: - p = Package(args[0], wc_check=False) - p.wc_repair() - print 'done. Please check the state of the wc (via \'osc status\').' - else: - print >>sys.stderr, 'osc: working copy is not inconsistent' + pacs = [] + for i in args: + if is_project_dir(i): + prj = Project(i, getPackageList=False) + for p in prj.pacs_have: + if p in prj.pacs_broken: + continue + try: + Package(os.path.join(i, p)) + except oscerr.WorkingCopyInconsistent: + pacs.append(os.path.join(i, p)) + elif is_package_dir(i): + pacs.append(i) + else: + print >>sys.stderr, '\'%s\' is neither a project working copy ' \ + 'nor a package working copy' % i + for i in pacs: + try: + p = Package(i) + except oscerr.WorkingCopyInconsistent: + p = Package(i, wc_check=False) + p.wc_repair() + print 'done. Please check the state of the wc (via \'osc status\').' + else: + print >>sys.stderr, 'osc: working copy is not inconsistent' # fini! ###############################################################################