Skip to content

Commit

Permalink
Use git apply --index and git reset --hard for patches.
Browse files Browse the repository at this point in the history
This helps when a patch does not apply cleanly to master,
we can just reset the tree and move on to the next patch.
  • Loading branch information
jrioux committed Mar 17, 2012
1 parent 1586a8d commit 343a471
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions patches/compile_lilypond_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,16 @@ def configure(self, issue_id=None):

def patch(self, filename, reverse=False):
os.chdir(self.src_build_dir)
reverse = "--reverse" if reverse else ""
cmd = "git apply %s %s" % (reverse, filename)
returncode = os.system(cmd)
if returncode != 0:
self.logfile.failed_step("patch %s" % reverse, filename)
raise Exception("Failed patch %s %s" % (reverse, filename))
self.logfile.add_success("applied patch %s %s" % (reverse, filename))
if reverse:
cmd = "git reset --hard"
else:
cmd = "git apply --index %s" % filename
try:
run(cmd)
except Exception as err:
self.logfile.failed_step(cmd, err)
raise err
self.logfile.add_success(cmd)

### actual building
def build(self, quick_make = False, issue_id=None):
Expand Down

0 comments on commit 343a471

Please sign in to comment.