1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

- potential fix for #657838("osc 0.130: osc repairwc fails totally - working copy useless")

- do_repairwc: added '--force-apiurl' option:
  ask once for an apiurl and force this apiurl for all inconsistent projects/packages
This commit is contained in:
Marcus Huewe 2010-12-07 20:35:12 +01:00
parent fffd0c395a
commit 68bb33f141
2 changed files with 7 additions and 6 deletions

View File

@ -6111,6 +6111,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for f in p.todo: for f in p.todo:
p.revert(f) p.revert(f)
@cmdln.option('--force-apiurl', action='store_true',
help='ask once for an apiurl and force this apiurl for all inconsistent projects/packages')
def do_repairwc(self, subcmd, opts, *args): def do_repairwc(self, subcmd, opts, *args):
"""${cmd_name}: try to repair an inconsistent working copy """${cmd_name}: try to repair an inconsistent working copy
@ -6144,13 +6146,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pacs = [] pacs = []
cp = conf.get_configParser(conf.config['conffile']) cp = conf.get_configParser(conf.config['conffile'])
apiurls = [i.rstrip('/') for i in cp.sections() if i != 'general'] apiurls = [i.rstrip('/') for i in cp.sections() if i != 'general']
apiurl = ''
for i in args: for i in args:
if is_project_dir(i): if is_project_dir(i):
try: try:
prj = Project(i, getPackageList=False) prj = Project(i, getPackageList=False)
except oscerr.WorkingCopyInconsistent, e: except oscerr.WorkingCopyInconsistent, e:
apiurl = None if '_apiurl' in e.dirty_files and (not apiurl or not opts.force_apiurl):
if '_apiurl' in e.dirty_files:
apiurl = get_apiurl(apiurls) apiurl = get_apiurl(apiurls)
prj = Project(i, getPackageList=False, wc_check=False) prj = Project(i, getPackageList=False, wc_check=False)
prj.wc_repair(apiurl) prj.wc_repair(apiurl)
@ -6170,8 +6172,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
try: try:
p = Package(pdir) p = Package(pdir)
except oscerr.WorkingCopyInconsistent, e: except oscerr.WorkingCopyInconsistent, e:
apiurl = None if '_apiurl' in e.dirty_files and (not apiurl or not opts.force_apiurl):
if '_apiurl' in e.dirty_files:
apiurl = get_apiurl(apiurls) apiurl = get_apiurl(apiurls)
p = Package(pdir, wc_check=False) p = Package(pdir, wc_check=False)
p.wc_repair(apiurl) p.wc_repair(apiurl)

View File

@ -470,7 +470,7 @@ class Project:
def wc_repair(self, apiurl=None): def wc_repair(self, apiurl=None):
global store global store
if not os.path.exists(os.path.join(self.dir, store, '_apiurl')): if not os.path.exists(os.path.join(self.dir, store, '_apiurl')) or apiurl:
if apiurl is None: if apiurl is None:
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \ msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
'no \'apiurl\' was passed to wc_repair' 'no \'apiurl\' was passed to wc_repair'
@ -899,7 +899,7 @@ class Package:
return dirty_files return dirty_files
def wc_repair(self, apiurl=None): def wc_repair(self, apiurl=None):
if not os.path.exists(os.path.join(self.storedir, '_apiurl')): if not os.path.exists(os.path.join(self.storedir, '_apiurl')) or apiurl:
if apiurl is None: if apiurl is None:
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \ msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
'no \'apiurl\' was passed to wc_repair' 'no \'apiurl\' was passed to wc_repair'