KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > perforce > P4Delete


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.taskdefs.optional.perforce;
19
20 import org.apache.tools.ant.BuildException;
21
22 /** Checkout files for deletion.
23  *
24  * Example Usage:<br>
25  * &lt;p4delete change="${p4.change}" view="//depot/project/foo.txt" /&gt;<br>
26  *
27  * Simple re-write of P4Edit changing 'edit' to 'delete'.<br>
28  *
29  * @todo What to do if file is already open in one of our changelists perhaps
30  * (See also {@link P4Edit P4Edit})?<br>
31  *
32  * @ant.task category="scm"
33  */

34 public class P4Delete extends P4Base {
35
36     // CheckStyle:VisibilityModifier OFF - bc
37
/**
38      * number of the change list to work on
39      */

40     public String JavaDoc change = null;
41     // CheckStyle:VisibilityModifier ON
42

43     /**
44      * An existing changelist number for the deletion; optional
45      * but strongly recommended.
46      * @param change the number of a change list
47      */

48     public void setChange(String JavaDoc change) {
49         this.change = change;
50     }
51
52     /**
53      * executes the p4 delete task
54      * @throws BuildException if there is no view specified
55      */

56     public void execute() throws BuildException {
57         if (change != null) {
58             P4CmdOpts = "-c " + change;
59         }
60         if (P4View == null) {
61             throw new BuildException("No view specified to delete");
62         }
63         execP4Command("-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this));
64     }
65 }
66
Popular Tags