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 | }
|