Commit b69da7d6 authored by Frederik Gladhorn's avatar Frederik Gladhorn
Browse files

Be more robust when a module fails to merge


The exception handling would actually mean that "cd .." was missed when
an exception occurred (eg no gerrit remote in repo).

Change-Id: I056e103cce6c5714a905c434e8341273d48db591
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@digia.com>
parent 602c8f9b
No related merge requests found
Showing with 25 additions and 17 deletions
......@@ -167,32 +167,40 @@ def process_modules(config):
continue
try:
os.chdir(module)
cmd_git_fetch = ["git", "fetch"]
subprocess.check_call(cmd_git_fetch, stdout=fnull, stderr=fnull)
try:
cmd_git_fetch = ["git", "fetch"]
subprocess.check_call(cmd_git_fetch, stdout=fnull, stderr=fnull)
cmd_git_cherry = ["git", "cherry", "origin/" + config.branch_to, "origin/" + config.branch_from, "-v"]
cherry_output = subprocess.check_output(cmd_git_cherry).decode('utf-8').strip()
cmd_git_cherry = ["git", "cherry", "origin/" + config.branch_to, "origin/" + config.branch_from, "-v"]
cherry_output = subprocess.check_output(cmd_git_cherry).decode('utf-8').strip()
change_count = 0
if len(cherry_output) > 0:
change_count = len(cherry_output.split('\n'))
change_count = 0
if len(cherry_output) > 0:
change_count = len(cherry_output.split('\n'))
if config.status:
print(cherry_output)
print(colors.GREEN, change_count, colors.ENDC, "patches to be merged in", module, "\n")
if config.status:
print(cherry_output)
print(colors.GREEN, change_count, colors.ENDC, "patches to be merged in", module, "\n")
if config.reset or config.merge or len(config.version):
reset_module(module, config)
if config.reset or config.merge or len(config.version):
reset_module(module, config)
if change_count > 0:
if not merge(module, config):
manual_merges.append(module)
if change_count > 0:
if not merge(module, config):
manual_merges.append(module)
except Exception as e:
logging.error("Command execution failed: %s", str(e))
import traceback
traceback.print_exc(file=sys.stdout)
finally:
os.chdir("..")
os.chdir("..")
except Exception as e:
logging.error("Command execution failed: %s", str(e))
logging.error("Changing current dir failed: %s", str(e))
import traceback
traceback.print_exc(file=sys.stdout)
if len(manual_merges):
print("Modules failed to merge: ", manual_merges)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment