diff --git a/mpcdf_push.py b/mpcdf_push.py index b93b426e445f727353ed0bb62e6b5314353e0d94..2ffb9535d8bd40dd4e31c4d892741284d49f238b 100644 --- a/mpcdf_push.py +++ b/mpcdf_push.py @@ -88,16 +88,27 @@ def do_mpcdf_push(self, subcmd, opts, *args): "Configure the enabled repositories first, with `osc mpcdf_enable_repositories`", file=sys.stderr) raise SystemExit(1) - req_id = osc.core.create_submit_request(api_url, from_project, package, dst_project=to_project, - message="Update {0} from {1}".format(package, from_project) if not opts.message else opts.message) - print("Submitted package {0} to {1} in request {2}".format(package, to_project, req_id)) - if not opts.batch: - print("\nPLEASE review the request by 'osc request show {0} --diff', or in the web interface\n".format(req_id)) - print("Press Ctrl-C to abort, any key to continue", end="") - input() - result = osc.core.change_request_state(api_url, req_id, 'accepted', "Accepted on the command line via 'osc mpcdf_push'") - print(" Accepting request {0}:".format(req_id), result) + req_id = None + try: + req_id = osc.core.create_submit_request(api_url, from_project, package, dst_project=to_project, + message="Update {0} from {1}".format(package, from_project) if not opts.message else opts.message) + except osc.core.HTTPError as e: + if e.code == 400: + if "The request contains no actions" in e.read(): + print("No source changes found, submit request not necessary") + else: + raise e + + if req_id: + print("Submitted package {0} to {1} in request {2}".format(package, to_project, req_id)) + if not opts.batch: + print("\nPLEASE review the request by 'osc request show {0} --diff', or in the web interface\n".format(req_id)) + print("Press Ctrl-C to abort, any key to continue", end="") + input() + result = osc.core.change_request_state(api_url, req_id, 'accepted', "Accepted on the command line via 'osc mpcdf_push'") + print(" Accepting request {0}:".format(req_id), result) + if not opts.batch: user = osc.conf.get_apiurl_usr(api_url) if user not in existing_maintainers: print("Adding you to the list of maintainers for this package")