It prints error messages when it fails, and sometimes we don't need to
see them since we don't care exactly _why_ it failed. (The only
current user does want to see the errors, but future patches will
introduce callers that don't.)
Signed-off-by: Karl Hasselström <kha@treskal.com>
.set_date(gitlib.Date.maybe(authdate))))
failed_diff = None
if diff:
.set_date(gitlib.Date.maybe(authdate))))
failed_diff = None
if diff:
- tree = repository.apply(cd.parent.data.tree, diff)
+ tree = repository.apply(cd.parent.data.tree, diff, quiet = False)
if tree == None:
failed_diff = diff
else:
if tree == None:
failed_diff = diff
else:
return None
finally:
index.delete()
return None
finally:
index.delete()
- def apply(self, tree, patch_text):
+ def apply(self, tree, patch_text, quiet):
"""Given a L{Tree} and a patch, will either return the new L{Tree}
that results when the patch is applied, or None if the patch
couldn't be applied."""
"""Given a L{Tree} and a patch, will either return the new L{Tree}
that results when the patch is applied, or None if the patch
couldn't be applied."""
try:
index.read_tree(tree)
try:
try:
index.read_tree(tree)
try:
- index.apply(patch_text)
+ index.apply(patch_text, quiet)
return index.write_tree()
except MergeException:
return None
return index.write_tree()
except MergeException:
return None
"""In-index merge, no worktree involved."""
self.run(['git', 'read-tree', '-m', '-i', '--aggressive',
base.sha1, ours.sha1, theirs.sha1]).no_output()
"""In-index merge, no worktree involved."""
self.run(['git', 'read-tree', '-m', '-i', '--aggressive',
base.sha1, ours.sha1, theirs.sha1]).no_output()
- def apply(self, patch_text):
+ def apply(self, patch_text, quiet):
"""In-index patch application, no worktree involved."""
try:
"""In-index patch application, no worktree involved."""
try:
- self.run(['git', 'apply', '--cached']
- ).raw_input(patch_text).no_output()
+ r = self.run(['git', 'apply', '--cached']).raw_input(patch_text)
+ if quiet:
+ r = r.discard_stderr()
+ r.no_output()
except run.RunException:
raise MergeException('Patch does not apply cleanly')
def delete(self):
except run.RunException:
raise MergeException('Patch does not apply cleanly')
def delete(self):