<p>Patrick Georgi has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21926">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">util/gitconfig: remove cborg2cros.py<br><br>util/scripts/gerrit-rebase and cross-repo-cherrypick serve the same<br>purpose and we don't need two of everything.<br><br>Change-Id: I66a71033a8a29249d214db4c31a67f8a0725163c<br>Signed-off-by: Patrick Georgi <pgeorgi@google.com><br>---<br>D util/gitconfig/cborg2cros.py<br>1 file changed, 0 insertions(+), 126 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/21926/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/util/gitconfig/cborg2cros.py b/util/gitconfig/cborg2cros.py<br>deleted file mode 100755<br>index 133b00a..0000000<br>--- a/util/gitconfig/cborg2cros.py<br>+++ /dev/null<br>@@ -1,126 +0,0 @@<br>-#!/usr/bin/env python<br>-<br>-# This file is part of the coreboot project.<br>-#<br>-# Copyright (C) 2016 Google, Inc.<br>-#<br>-# This program is free software; you can redistribute it and/or modify<br>-# it under the terms of the GNU General Public License as published by<br>-# the Free Software Foundation; version 2 of the License.<br>-#<br>-# This program is distributed in the hope that it will be useful,<br>-# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>-# GNU General Public License for more details.<br>-<br>-import sys<br>-import re<br>-import subprocess<br>-<br>-# Regular expression patterns<br>-pat_change_id = re.compile('^Change-Id: (.*)$')<br>-pat_orig_lines = re.compile('^(Signed-off-by|Reviewed-on|Reviewed-by)')<br>-pat_uninteresting = re.compile('^Tested-by')<br>-pat_quotes = re.compile('"')<br>-pat_leading_space = re.compile('^ ')<br>-pat_bug_line = re.compile('^bug\s*=', re.IGNORECASE)<br>-pat_branch_line = re.compile('branch\s*=', re.IGNORECASE)<br>-pat_test_line = re.compile('test\s*=', re.IGNORECASE)<br>-<br>-def main():<br>-    branch = ""<br>-    new_commit_message = ""<br>-    change_id = ""<br>-    commit_id = ""<br>-    bug_line = "BUG=None\n"<br>-    branch_line = "BRANCH=None\n"<br>-    test_line = "TEST=Build tested at coreboot.org\n"<br>-<br>-    # Check command line arguments<br>-    if len(sys.argv) > 1:<br>-        if sys.argv[1] == "-h" or sys.argv[1] == "--help":<br>-            print "Update the commit message to submit to the Chrome OS tree."<br>-            print "Usage: " + sys.argv[1] + " [Remote branch]\n"<br>-        else:<br>-            branch = sys.argv[1]<br>-    else:<br>-        branch = "cborg/master"<br>-<br>-    # Get the last commit message, then loop through looking at each line<br>-    commit_message = subprocess.check_output(["git", "log", "-n1"]).split("\n")<br>-    for line in commit_message:<br>-<br>-        # Skip the initial few lines of the commit message<br>-        m = pat_leading_space.match(line)<br>-        if not m:<br>-            continue<br>-<br>-        # Remove initial whitespace<br>-        line = line.lstrip(' ')<br>-<br>-        # Add the 'UPSTREAM' comment to the subject line<br>-        if len(new_commit_message) == 0:<br>-            new_commit_message += "UPSTREAM: " + line + "\n"<br>-            continue<br>-<br>-        # If we've found a TEST, BRANCH, or BUG line, mark it as found<br>-        if pat_test_line.match(line):<br>-            test_line = ""<br>-        if pat_bug_line.match(line):<br>-            bug_line = ""<br>-        if pat_branch_line.match(line):<br>-            branch_line = ""<br>-<br>-        # Grab the Change-Id<br>-        chid = pat_change_id.match(line)<br>-        if chid:<br>-            change_id = chid.group(1)<br>-<br>-        # Add 'Original-' to all of the coreboot.org gerrit messages<br>-        grrt = pat_orig_lines.match(line)<br>-        if grrt:<br>-            line = "Original-" + line<br>-<br>-        # if we've reached the end of the real commit message text and we don't<br>-        # have the required TEST= BUG= and BRANCH= lines, add them.<br>-        if (chid or grrt) and (bug_line or branch_line or test_line):<br>-            new_commit_message += bug_line + branch_line + test_line + "\n"<br>-            bug_line = branch_line = test_line = ""<br>-<br>-        # Remove uninteresting gerrit messages<br>-        if pat_uninteresting.match(line):<br>-            continue<br>-<br>-        # Add the current line to the updated commit message<br>-        new_commit_message += line + "\n"<br>-<br>-    # Error out if no Change-Id was located<br>-    if not change_id:<br>-        print "Error: No Change-Id found"<br>-        sys.exit(1)<br>-<br>-    # Get the Commit ID based on the Change-Id and the branch.<br>-    # Error out if git returns an error<br>-    try:<br>-        commit_id = subprocess.check_output(["git", "log", "-n1", "--grep", change_id, '--pretty=%H', branch, "--"]).rstrip('\n')<br>-    except:<br>-        print "Error: invalid branch - " + branch + ".\n"<br>-        sys.exit(1)<br>-<br>-    # To find the Commit-Id, we've looked through the git log for a particular Change-Id<br>-    # Error out if the Commit-Id wasn't found, with the message that we couldn't find the Change-Id<br>-    if not commit_id:<br>-        print "Error: Could not find Change-Id: " + change_id + " in branch " + branch + ".\n"<br>-        sys.exit(1)<br>-<br>-    # Add the Commit-Id that this change came from to the new commit message.<br>-    new_commit_message += "(cherry-picked from commit " + commit_id + ")\n"<br>-<br>-    # Update the commit message<br>-    amend_output = subprocess.check_output(["git", "commit", "-s", "--amend", "-m", new_commit_message ])<br>-<br>-    print "----------\n"<br>-    print amend_output<br>-<br>-if __name__ == "__main__":<br>-    main()<br></pre><p>To view, visit <a href="https://review.coreboot.org/21926">change 21926</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21926"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I66a71033a8a29249d214db4c31a67f8a0725163c </div>
<div style="display:none"> Gerrit-Change-Number: 21926 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Georgi <pgeorgi@google.com> </div>