package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.tools.ant.BuildException; /** Checkout files for deletion. * * Example Usage:<br> * <p4delete change="${p4.change}" view="//depot/project/foo.txt" /><br> * * Simple re-write of P4Edit changing 'edit' to 'delete'.<br> * * @todo What to do if file is already open in one of our changelists perhaps * (See also {@link P4Edit P4Edit})?<br> * * @ant.task category="scm" */ public class P4Delete extends P4Base { // CheckStyle:VisibilityModifier OFF - bc /** * number of the change list to work on */ public String change = null; // CheckStyle:VisibilityModifier ON /** * An existing changelist number for the deletion; optional * but strongly recommended. * @param change the number of a change list */ public void setChange(String change) { this.change = change; } /** * executes the p4 delete task * @throws BuildException if there is no view specified */ public void execute() throws BuildException { if (change != null) { P4CmdOpts = "-c " + change; } if (P4View == null) { throw new BuildException("No view specified to delete"); } execP4Command("-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); } }
package org.apache.tools.ant.taskdefs.optional.perforce; import org.apache.tools.ant.BuildException; /** * Open file(s) for edit. * P4Change should be used to obtain a new changelist for P4Edit as, * although P4Edit can open files to the default change, * P4Submit cannot yet submit to it. * Example Usage:<br> * <p4edit change="${p4.change}" view="//depot/project/foo.txt" /> * * @todo Should call reopen if file is already open in one of our changelists perhaps? * * @ant.task category="scm" */ public class P4Edit extends P4Base { // CheckStyle:VisibilityModifier OFF - bc /** * number of the change list to work on */ public String change = null; // CheckStyle:VisibilityModifier ON /** * An existing changelist number to assign files to; optional * but strongly recommended. * @param change the change list number */ public void setChange(String change) { this.change = change; } /** * Run the p4 edit command * @throws BuildException if there is no view specified */ public void execute() throws BuildException { if (change != null) { P4CmdOpts = "-c " + change; } if (P4View == null) { throw new BuildException("No view specified to edit"); } execP4Command("-s edit " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
package org.apache.tools.ant.taskdefs.optional.perforce;
1
package org.apache.tools.ant.taskdefs.optional.perforce;
2
import org.apache.tools.ant.BuildException;
2
import org.apache.tools.ant.BuildException;
3
/** Checkout files for deletion.
3
/**
4
 *
4
 * Open file(s) for edit.
5
 * P4Change should be used to obtain a new changelist for P4Edit as,
6
 * although P4Edit can open files to the default change,
7
 * P4Submit cannot yet submit to it.
5
 * Example Usage:<br>
8
 * Example Usage:<br>
6
 * <p4delete change="${p4.change}" view="//depot/project/foo.txt" /><br>
9
 * <p4edit change="${p4.change}" view="//depot/project/foo.txt" />
7
 *
8
 * Simple re-write of P4Edit changing 'edit' to 'delete'.<br>
9
 *
10
 * @todo What to do
10
 *
11
 if file is already open in one of our changelists perhaps
11
 * @todo Should call reopen if file is already open in one of our changelists perhaps
12
 * (See also {@link P4Edit P4Edit})?<br>
12
?
13
 *
13
 *
14
 * @ant.task category="scm"
14
 * @ant.task category="scm"
15
 */
15
 */
16
public class P4Delete extends P4Base {
16
public class P4Edit extends P4Base {
17
    // CheckStyle:VisibilityModifier OFF - bc
17
    // CheckStyle:VisibilityModifier OFF - bc
18
    /**
18
    /**
19
     * number of the change list to work on
19
     * number of the change list to work on
20
     */
20
     */
21
    public String change = null;
21
    public String change = null;
22
    // CheckStyle:VisibilityModifier ON
22
    // CheckStyle:VisibilityModifier ON
23
    /**
23
    /**
24
     * An existing changelist number for the deletion; optional
24
     * An existing changelist number to assign files to; optional
25
     * but strongly recommended.
25
     * but strongly recommended.
26
     * @param change the number of a change list
26
     * @param change the change list number
27
     */
27
     */
28
    public void setChange(String change) {
28
    public void setChange(String change) {
29
        this.change = change;
29
        this.change = change;
30
    }
30
    }
31
    /**
31
    /**
32
     * executes the p4 delete task
32
     * Run the p4 edit command
33
     * @throws BuildException if there is no view specified
33
     * @throws BuildException if there is no view specified
34
     */
34
     */
35
    public void execute() throws BuildException {
35
    public void execute() throws BuildException {
36
        if (change != null) {
36
        if (change != null) {
37
            P4CmdOpts = "-c " + change;
37
            P4CmdOpts = "-c " + change;
38
        }
38
        }
39
        if (P4View == null) {
39
        if (P4View == null) {
40
            throw new BuildException("No view specified to delete");
40
            throw new BuildException("No view specified to edit");
41
        }
41
        }
42
        execP4Command("-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this));
42
        execP4Command("-s edit " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this));
43
    }
43
    }
44
}
44
}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0