From 2a0dc6e022413fb93da2e053ff943fca908a6de3 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 7 Jul 2003 13:05:03 +0000 Subject: [PATCH] Add destfile attribute to patch. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274783 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ docs/manual/CoreTasks/patch.html | 8 +++++++- src/main/org/apache/tools/ant/taskdefs/Patch.java | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 1ee15e205..eb5e295a9 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -467,6 +467,9 @@ Other changes: enable it to expand archives created with filenames using an encoding other than UTF8. Bugzilla Report 10504. +* has a new attribute destfile that can be used to create a new + file instead of patching files in place. + Changes from Ant 1.5.2 to Ant 1.5.3 =================================== diff --git a/docs/manual/CoreTasks/patch.html b/docs/manual/CoreTasks/patch.html index f075a59e7..5bfa28dae 100644 --- a/docs/manual/CoreTasks/patch.html +++ b/docs/manual/CoreTasks/patch.html @@ -29,6 +29,12 @@ No, tries to guess it from the diff file + + destfile + the file to send the output to instead of + patching the file(s) in place. since Ant 1.6 + No. + backups Keep backups of the unpatched files @@ -75,7 +81,7 @@ the diff output looked like

the leading a/ will be stripped.
-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.

diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java index 35a5e782e..09ddbcf26 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000,2002 The Apache Software Foundation. All rights + * Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,19 @@ public class Patch extends Task { originalFile = file; } + /** + * The name of a file to send the output to, instead of patching + * the file(s) in place; optional. + * + * @since Ant 1.6 + */ + public void setDestfile(File file) { + if (file != null) { + cmd.createArgument().setValue("-o"); + cmd.createArgument().setFile(file); + } + } + /** * The file containing the diff output; required. */