From 9a45123e37e8a57d361c7a1cb56b824d2c4e83f9 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 5 Apr 2013 14:26:52 +0200 Subject: [PATCH] git tracker: handle temporary failures better If there are multiple commits in the source kernel, one of which causes backporting failures (ie. patches don't apply), and a subsequent one fixes it, the output is very confusing because it skips the failing commit. Change the script to generate a combination commit in this case that contains the shortlog of all the commits inbetween that were broken. Signed-off-by: Johannes Berg --- devel/git-tracker.py | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/devel/git-tracker.py b/devel/git-tracker.py index 526e5ac8b682..7bf4c605de59 100755 --- a/devel/git-tracker.py +++ b/devel/git-tracker.py @@ -41,7 +41,7 @@ def update_cache_objects(gittree, objdir): git.remote_update(objdir) def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, backport_rev, kernel_rev, - prev_kernel_rev=None, defconfig=None, env={}): + prev_kernel_rev=None, defconfig=None, env={}, commit_failure=True): log = [] def logwrite(l): log.append(l) @@ -93,8 +93,9 @@ def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, ba 'krev': kernel_rev, } - git.commit(msg, tree=wdir, env=env, opts=['-q', '--allow-empty']) - git.push(opts=['-f', '-q', 'origin', branch], tree=wdir) + if not failure or commit_failure: + git.commit(msg, tree=wdir, env=env, opts=['-q', '--allow-empty']) + git.push(opts=['-f', '-q', 'origin', branch], tree=wdir) os.rename(os.path.join(wdir, '.git'), wgitdir) finally: if os.path.isdir(wdir): @@ -205,26 +206,42 @@ if __name__ == '__main__': # update from old to new if last_success in old_data: prev = old_data[last_success] + catch_up_from_failure = True else: prev = old_data[tree] + catch_up_from_failure = False commits = git.log_commits(prev, kernel_head, tree=kernelobjdir) if len(commits) > MAX_COMMITS: print "too many commits (%d)!" % len(commits) sys.exit(10) + prev_commits = {} + p = None + for commit in commits: + prev_commits[commit] = p + p = commit for commit in commits: print 'updating to commit', commit env = git.commit_env_vars(commit, tree=kernelobjdir) - msg = git.commit_message(commit, kernelobjdir) - try: - # add information about commits that went into this - shortlog = git.shortlog(prev, '%s^2' % commit, - tree=kernelobjdir) - msg += "\nCommits in this merge:\n\n" + shortlog - except git.ExecutionError, e: - # will fail if it wasn't a merge commit - pass + if prev_commits[commit] == prev: + # committing multiple commits + msg = git.commit_message(commit, kernelobjdir) + try: + # add information about commits that went into this + shortlog = git.shortlog(prev, '%s^2' % commit, + tree=kernelobjdir) + msg += "\nCommits in this merge:\n\n" + shortlog + except git.ExecutionError, e: + # will fail if it wasn't a merge commit + pass + else: + # multiple commits + env = backport_author_env + msg = "update multiple kernel commits\n\nCommits taken:\n\n" + msg += git.shortlog(prev, commit, tree=kernelobjdir) failure = handle_commit(args, msg, branch, tree, kernelobjdir, branch_tmpdir, wgitdir, backport_rev, commit, env=env, - prev_kernel_rev=prev, defconfig=defconfig) + prev_kernel_rev=prev, defconfig=defconfig, + commit_failure=not catch_up_from_failure) if not failure: prev = commit + catch_up_from_failure = False -- 2.30.2