My idea is to add something like this:

        if ( clean )
        {
            if ( ! ( wagon instanceof CommandExecutor ) )
            {
                throw new UnsupportedProtocolException( "Wagon " +
wagon.getRepository().getProtocol() + " does not support clean upload" );
            }

            String targetRepoBaseDirectory =
wagon.getRepository().getBasedir(); 

            String command = "rm -rf " + targetRepoBaseDirectory + "/*";

            logger.info( "Remote: " + command );
            ( (CommandExecutor) wagon ).executeCommand( command );
        }

to the beginning of the "public void upload( Wagon wagon, FileSet
fileset, boolean optimize, boolean clean, Log logger )" method in
DefaultWagonUpload.

-Knute

to the beginning of

On 6/25/2009 10:31 PM, Dan Tran wrote:
> I guest it would work if the target provider has a delete api.
>
> -Dan
>
> On Thu, Jun 25, 2009 at 7:21 PM, Brett Porter<br...@apache.org> wrote:
>   
>> On 26/06/2009, at 12:17 PM, Brett Porter wrote:
>>
>>     
>>> Duh, of course :) I was looking at it from the get PoV.
>>>       
>> Sorry, hit send early accidentally. I meant to add that (now that I
>> understand what was actually meant), it sounds like a good idea. I'm
>> guessing the implementation uses list and then subsequent deletes - it
>> probably works but is not very performant?
>>
>> - Brett
>>
>>
>>     
>>> On 26/06/2009, at 12:12 PM, Dan Tran wrote:
>>>
>>>       
>>>> Brett, i think Knute wants to delete remote files on the target host
>>>>
>>>> -D
>>>>
>>>> On Thu, Jun 25, 2009 at 6:04 PM, Brett Porter<br...@apache.org> wrote:
>>>>         
>>>>> I know it is verbose, but you can achieve this by binding in the clean
>>>>> plugin right?
>>>>>
>>>>> - Brett
>>>>>
>>>>> On 26/06/2009, at 5:21 AM, Knute G. Axelson wrote:
>>>>>
>>>>>           
>>>>>> I'd like to see the wagon plugin support an option that would empty out
>>>>>> the target directory before copying files when using the upload goal.
>>>>>> Any thoughts?
>>>>>>
>>>>>> I've actually already coded this up and would be happy to contribute it
>>>>>> if others think it would be generally useful.
>>>>>>
>>>>>> -kaxelson
>>>>>>             
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>   

Reply via email to