Use git's path stripping when upstreaming patches.

This commit is contained in:
Josh Matthews 2017-06-19 19:14:28 -04:00 committed by Ms2ger
parent 578498ba24
commit d9baadd3df
2 changed files with 8 additions and 24 deletions

View file

@ -69,7 +69,7 @@ class GitTree(wptupdate.tree.GitTree):
data = self.git("log", *args)
return [self.commit_cls(self, sha1) for sha1 in data.split("\0") if sha1]
def import_patch(self, patch):
def import_patch(self, patch, strip_count):
"""Import a patch file into the tree and commit it
:param patch: a Patch object containing the patch to import
@ -79,7 +79,7 @@ class GitTree(wptupdate.tree.GitTree):
f.write(patch.diff)
f.flush()
f.seek(0)
self.git("apply", "--index", f.name)
self.git("apply", "--index", f.name, "-p", str(strip_count))
self.git("commit", "-m", patch.message.text, "--author=%s" % patch.full_author)
def rebase(self, ref, continue_rebase=False):