Auto merge of #6036 - jgraham:wpt_upstream_binary, r=Ms2ger

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6036)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-15 04:17:38 -05:00
commit f554ab1c4d
2 changed files with 43 additions and 2 deletions

View file

@ -173,12 +173,12 @@ class GeckoCommit(Commit):
def export_patch(self, path=None):
"""Convert a commit in the tree to a Patch with the bug number and
reviewer stripped from the message"""
args = ["%s^..%s" % (self.sha1, self.sha1)]
args = ["--binary", self.sha1]
if path is not None:
args.append("--")
args.append(path)
diff = self.git("diff", *args)
diff = self.git("show", *args)
return Patch(self.author, self.email, self.message, diff)

View file

@ -158,6 +158,46 @@ class LoadCommits(Step):
self.logger.debug("Source commits: %s" % state.source_commits)
class SelectCommits(Step):
"""Provide a UI to select which commits to upstream"""
def create(self, state):
if not state.source_commits:
return
while True:
commits = state.source_commits[:]
for i, commit in enumerate(commits):
print "%i:\t%s" % (i, commit.message.summary)
remove = raw_input("Provide a space-separated list of any commits numbers to remove from the list to upstream:\n").strip()
remove_idx = set()
invalid = False
for item in remove.split(" "):
try:
item = int(item)
except:
invalid = True
break
if item < 0 or item >= len(commits):
invalid = True
break
remove_idx.add(item)
if invalid:
continue
keep_commits = [(i,cmt) for i,cmt in enumerate(commits) if i not in remove_idx]
#TODO: consider printed removed commits
print "Selected the following commits to keep:"
for i, commit in keep_commits:
print "%i:\t%s" % (i, commit.message.summary)
confirm = raw_input("Keep the above commits? y/n\n").strip().lower()
if confirm == "y":
state.source_commits = [item[1] for item in keep_commits]
break
class MovePatches(Step):
"""Convert gecko commits into patches against upstream and commit these to the sync tree."""
@ -329,6 +369,7 @@ class SyncToUpstreamRunner(StepRunner):
GetLastSyncCommit,
GetBaseCommit,
LoadCommits,
SelectCommits,
MovePatches,
RebaseCommits,
CheckRebase,