Skip to content

Commit

Permalink
Pass -p to 'git apply', pass correct patch component
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Apr 4, 2012
1 parent 6da04ee commit dd668ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion master/buildbot/steps/source/git.py
Expand Up @@ -288,7 +288,8 @@ def renameBranch(res):
return d

def patch(self, _, patch):
d = self._dovccmd(['apply', '--index'], initialStdin=patch)
d = self._dovccmd(['apply', '--index', '-p', str(patch[0])],
initialStdin=patch[1])
return d

@defer.inlineCallbacks
Expand Down
8 changes: 4 additions & 4 deletions master/buildbot/test/unit/test_steps_source_git.py
Expand Up @@ -62,7 +62,7 @@ def test_mode_full_clean_patch(self):
self.setupStep(
git.Git(repourl='http://github.com/buildbot/buildbot.git',
mode='full', method='clean'),
patch = 'patch')
patch=(1, 'patch'))
self.expectCommands(
ExpectShell(workdir='wkdir',
command=['git', '--version'])
Expand All @@ -82,7 +82,7 @@ def test_mode_full_clean_patch(self):
command=['git', 'reset', '--hard', 'FETCH_HEAD'])
+ 0,
ExpectShell(workdir='wkdir',
command=['git', 'apply', '--index'],
command=['git', 'apply', '--index', '-p', '1'],
initialStdin='patch')
+ 0,
ExpectShell(workdir='wkdir',
Expand All @@ -98,7 +98,7 @@ def test_mode_full_clean_patch_fail(self):
self.setupStep(
git.Git(repourl='http://github.com/buildbot/buildbot.git',
mode='full', method='clean'),
patch = 'patch')
patch=(1, 'patch'))
self.expectCommands(
ExpectShell(workdir='wkdir',
command=['git', '--version'])
Expand All @@ -118,7 +118,7 @@ def test_mode_full_clean_patch_fail(self):
command=['git', 'reset', '--hard', 'FETCH_HEAD'])
+ 0,
ExpectShell(workdir='wkdir',
command=['git', 'apply', '--index'],
command=['git', 'apply', '--index', '-p', '1'],
initialStdin='patch')
+ 1,
)
Expand Down

0 comments on commit dd668ee

Please sign in to comment.