mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- check for pending requests after executing an action (e.g. checkout, update, commit). This check is disabled by default. (requested by darix)
This commit is contained in:
parent
b195202be5
commit
0c5a9528e3
@ -1630,6 +1630,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
project_dir = None
|
||||
checkout_package(apiurl, project, package,
|
||||
rev, expand_link=expand_link, prj_dir=project_dir, service_files=service_files)
|
||||
print_request_list(apiurl, project, package)
|
||||
|
||||
elif project:
|
||||
prj_dir = project
|
||||
@ -1655,6 +1656,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# check out in unexpanded form at least
|
||||
checkout_package(apiurl, project, package,
|
||||
expand_link = False, prj_dir = prj_dir, service_files = service_files)
|
||||
print_request_list(apiurl, project)
|
||||
|
||||
else:
|
||||
raise oscerr.WrongArgs('Missing argument.\n\n' \
|
||||
@ -1803,10 +1805,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
pacs = findpacs(args)
|
||||
for p in pacs:
|
||||
|
||||
p.todo = p.filenamelist + p.filenamelist_unvers
|
||||
|
||||
|
||||
for filename in p.todo:
|
||||
if os.path.isdir(filename):
|
||||
continue
|
||||
@ -1988,6 +1988,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# (b) fetch new packages
|
||||
prj.checkout_missing_pacs(opts.expand_link)
|
||||
args.remove(arg)
|
||||
print_request_list(prj.apiurl, prj.name)
|
||||
|
||||
args.sort()
|
||||
pacs = findpacs(args)
|
||||
@ -2026,6 +2027,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
sys.exit(1)
|
||||
p.update(rev, service_files)
|
||||
rev = None
|
||||
print_request_list(p.apiurl, p.prjname, p.name)
|
||||
|
||||
|
||||
@cmdln.option('-f', '--force', action='store_true',
|
||||
@ -2122,7 +2124,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
pacs = findpacs(args)
|
||||
|
||||
for p in pacs:
|
||||
|
||||
for filename in p.todo:
|
||||
print 'Resolved conflicted state of "%s"' % filename
|
||||
p.clear_from_conflictlist(filename)
|
||||
@ -2809,7 +2810,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
args = parseargs(args)
|
||||
pacs = findpacs(args)
|
||||
|
||||
|
||||
for p in pacs:
|
||||
print p.info()
|
||||
|
||||
|
@ -102,6 +102,8 @@ DEFAULTS = { 'apiurl': 'https://api.opensuse.org',
|
||||
'request_list_days': 30,
|
||||
# check for unversioned/removed files before commit
|
||||
'check_filelist': '1',
|
||||
# check for pending requests after executing an action (e.g. checkout, update, commit)
|
||||
'check_for_request_on_action': '0',
|
||||
}
|
||||
|
||||
# being global to this module, this dict can be accessed from outside
|
||||
@ -109,7 +111,7 @@ DEFAULTS = { 'apiurl': 'https://api.opensuse.org',
|
||||
config = DEFAULTS.copy()
|
||||
|
||||
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
|
||||
'checkout_no_colon']
|
||||
'checkout_no_colon', 'check_for_request_on_action']
|
||||
|
||||
new_conf_template = """
|
||||
[general]
|
||||
@ -177,7 +179,10 @@ apiurl = %(apiurl)s
|
||||
|
||||
# check for unversioned/removed files before commit
|
||||
#check_filelist = 1
|
||||
|
||||
|
||||
# check for pending requests after executing an action (e.g. checkout, update, commit)
|
||||
#check_for_request_on_action = 0
|
||||
|
||||
[%(apiurl)s]
|
||||
user = %(user)s
|
||||
pass = %(pass)s
|
||||
|
17
osc/core.py
17
osc/core.py
@ -883,6 +883,7 @@ class Package:
|
||||
for filename in self.todo:
|
||||
if filename.startswith('_service:') and os.path.exists(filename):
|
||||
os.unlink(filename) #remove local files
|
||||
print_request_list(self.apiurl, self.prjname, self.name)
|
||||
|
||||
def write_conflictlist(self):
|
||||
if len(self.in_conflict) == 0:
|
||||
@ -4260,3 +4261,19 @@ def check_filelist_before_commit(pacs):
|
||||
break
|
||||
else:
|
||||
raise oscerr.UserAbort()
|
||||
|
||||
def print_request_list(apiurl, project, package = None, states = ('new', ), force = False):
|
||||
"""
|
||||
prints list of pending requests for the specified project/package if "check_for_request_on_action"
|
||||
is enabled in the config or if "force" is set to True
|
||||
"""
|
||||
if not conf.config['check_for_request_on_action'] and not force:
|
||||
return
|
||||
requests = get_request_list(apiurl, project, package, req_state=states)
|
||||
msg = 'Pending requests for %s: %s (%s)'
|
||||
if package is None and len(requests):
|
||||
print msg % ('project', project, len(requests))
|
||||
elif len(requests):
|
||||
print msg % ('package', package, len(requests))
|
||||
for r in requests:
|
||||
print r.list_view()
|
||||
|
Loading…
Reference in New Issue
Block a user