587
|
1 |
/*
|
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3 |
* or more contributor license agreements. See the NOTICE file
|
|
4 |
* distributed with this work for additional information
|
|
5 |
* regarding copyright ownership. The ASF licenses this file
|
|
6 |
* to you under the Apache License, Version 2.0 (the
|
|
7 |
* "License"); you may not use this file except in compliance
|
|
8 |
* with the License. You may obtain a copy of the License at
|
|
9 |
*
|
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11 |
*
|
|
12 |
* Unless required by applicable law or agreed to in writing,
|
|
13 |
* software distributed under the License is distributed on an
|
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15 |
* KIND, either express or implied. See the License for the
|
|
16 |
* specific language governing permissions and limitations
|
|
17 |
* under the License.
|
|
18 |
*/
|
|
19 |
|
|
20 |
/* Portion Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.*/
|
|
21 |
|
|
22 |
package com.nokia.maven.scm.provider.hg.command.remove;
|
|
23 |
|
628
|
24 |
import java.io.File;
|
|
25 |
|
587
|
26 |
import org.apache.maven.scm.ScmException;
|
|
27 |
import org.apache.maven.scm.ScmFileSet;
|
|
28 |
import org.apache.maven.scm.ScmResult;
|
|
29 |
import org.apache.maven.scm.command.Command;
|
|
30 |
import org.apache.maven.scm.command.remove.AbstractRemoveCommand;
|
|
31 |
import org.apache.maven.scm.command.remove.RemoveScmResult;
|
|
32 |
import org.apache.maven.scm.provider.ScmProviderRepository;
|
|
33 |
import org.apache.maven.scm.provider.hg.HgUtils;
|
|
34 |
import org.apache.maven.scm.provider.hg.command.HgCommandConstants;
|
|
35 |
import org.apache.maven.scm.provider.hg.command.remove.HgRemoveConsumer;
|
|
36 |
|
|
37 |
/**
|
|
38 |
* Branch version of the remove command, to fix the command line generation.
|
|
39 |
*/
|
|
40 |
public class HgRemoveCommand
|
|
41 |
extends AbstractRemoveCommand
|
|
42 |
implements Command
|
|
43 |
{
|
|
44 |
/** {@inheritDoc} */
|
|
45 |
protected ScmResult executeRemoveCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message )
|
|
46 |
throws ScmException
|
|
47 |
{
|
|
48 |
|
|
49 |
String[] command = new String[] { HgCommandConstants.REMOVE_CMD };
|
|
50 |
command = HgUtils.expandCommandLine( command, fileSet );
|
|
51 |
|
|
52 |
File workingDir = fileSet.getBasedir();
|
|
53 |
HgRemoveConsumer consumer = new HgRemoveConsumer( getLogger(), workingDir );
|
|
54 |
|
|
55 |
ScmResult result = HgUtils.execute( consumer, getLogger(), workingDir, command );
|
|
56 |
return new RemoveScmResult( consumer.getRemovedFiles(), result );
|
|
57 |
}
|
|
58 |
}
|