added git reset
This commit is contained in:
parent
4bb77853ca
commit
d99d32bdaa
1 changed files with 2 additions and 2 deletions
|
@ -79,6 +79,7 @@ class ApplyPatch:
|
||||||
self.repo.git.checkout(base_revision)
|
self.repo.git.checkout(base_revision)
|
||||||
print('Revision is {}'.format(self.repo.head.commit.hexsha))
|
print('Revision is {}'.format(self.repo.head.commit.hexsha))
|
||||||
print('Cleanup...')
|
print('Cleanup...')
|
||||||
|
self.repo.git.reset('--hard')
|
||||||
self.repo.git.clean('-fdx')
|
self.repo.git.clean('-fdx')
|
||||||
print('Analyzing {}'.format(diff_to_str(revision_id)))
|
print('Analyzing {}'.format(diff_to_str(revision_id)))
|
||||||
if len(dependencies) > 0:
|
if len(dependencies) > 0:
|
||||||
|
@ -138,7 +139,7 @@ class ApplyPatch:
|
||||||
"""Download and apply a diff to the local working copy."""
|
"""Download and apply a diff to the local working copy."""
|
||||||
print('Applying diff {} for revision {}...'.format(diff_id, diff_to_str(revision_id)))
|
print('Applying diff {} for revision {}...'.format(diff_id, diff_to_str(revision_id)))
|
||||||
diff = self.phab.differential.getrawdiff(diffID=diff_id).response
|
diff = self.phab.differential.getrawdiff(diffID=diff_id).response
|
||||||
proc = subprocess.run('git apply', input=diff, shell=True, text=True,
|
proc = subprocess.run('git apply --whitespace=nowarn --binary -v', input=diff, shell=True, text=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise Exception('Applying patch failed:\n{}'.format(proc.stdout + proc.stderr))
|
raise Exception('Applying patch failed:\n{}'.format(proc.stdout + proc.stderr))
|
||||||
|
@ -149,7 +150,6 @@ class ApplyPatch:
|
||||||
# take the diff_id with the highest number, this should be latest one
|
# take the diff_id with the highest number, this should be latest one
|
||||||
diff_id = max(revision['diffs'])
|
diff_id = max(revision['diffs'])
|
||||||
self._apply_diff(diff_id, revision_id)
|
self._apply_diff(diff_id, revision_id)
|
||||||
|
|
||||||
|
|
||||||
def _write_error_message(self):
|
def _write_error_message(self):
|
||||||
"""Write the log message to a file."""
|
"""Write the log message to a file."""
|
||||||
|
|
Loading…
Reference in a new issue