Browse Source

Javadoc

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277584 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
2954b4d477
1 changed files with 10 additions and 15 deletions
  1. +10
    -15
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java

+ 10
- 15
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -22,15 +22,16 @@


package org.apache.tools.ant.taskdefs.optional.perforce; package org.apache.tools.ant.taskdefs.optional.perforce;



import java.io.File; import java.io.File;
import java.util.Vector; import java.util.Vector;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


/** Adds specified files to Perforce.
/**
* Adds specified files to Perforce.
* *
* <b>Example Usage:</b> * <b>Example Usage:</b>
* <table border="1"> * <table border="1">
@@ -57,7 +58,7 @@ public class P4Add extends P4Base {
private int cmdLength = DEFAULT_CMD_LENGTH; private int cmdLength = DEFAULT_CMD_LENGTH;


/** /**
* positive integer specifying the maximum length
* Set the maximum length
* of the commandline when calling Perforce to add the files. * of the commandline when calling Perforce to add the files.
* Defaults to 450, higher values mean faster execution, * Defaults to 450, higher values mean faster execution,
* but also possible failures. * but also possible failures.
@@ -77,7 +78,7 @@ public class P4Add extends P4Base {
* specified pending changelist number; otherwise the open files are * specified pending changelist number; otherwise the open files are
* associated with the default changelist. * associated with the default changelist.
* *
* @param changelist the change list number
* @param changelist the change list number.
* *
* @throws BuildException if trying to set a change list number &lt;=0. * @throws BuildException if trying to set a change list number &lt;=0.
*/ */
@@ -85,30 +86,27 @@ public class P4Add extends P4Base {
if (changelist <= 0) { if (changelist <= 0) {
throw new BuildException("P4Add: Changelist# should be a positive number"); throw new BuildException("P4Add: Changelist# should be a positive number");
} }

this.changelist = changelist; this.changelist = changelist;
} }


/** /**
* files to add
* Add a fileset whose files will be added to Perforce.
* *
* @param set the FileSet that one wants to add to Perforce Source Control
* @param set the FileSet that one wants to add to Perforce Source Control.
*/ */
public void addFileset(FileSet set) { public void addFileset(FileSet set) {
filesets.addElement(set); filesets.addElement(set);
} }


/** /**
* run the task.
* Run the task.
* *
* @throws BuildException if the execution of the Perforce command fails. * @throws BuildException if the execution of the Perforce command fails.
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {

if (P4View != null) { if (P4View != null) {
addCmd = P4View; addCmd = P4View;
} }

P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : ""; P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : "";


StringBuffer filelist = new StringBuffer(); StringBuffer filelist = new StringBuffer();
@@ -116,7 +114,6 @@ public class P4Add extends P4Base {
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject()); DirectoryScanner ds = fs.getDirectoryScanner(getProject());
//File fromDir = fs.getDir(project);


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
if (srcFiles != null) { if (srcFiles != null) {
@@ -135,12 +132,10 @@ public class P4Add extends P4Base {
log("No files specified to add!", Project.MSG_WARN); log("No files specified to add!", Project.MSG_WARN);
} }
} }

} }


private void execP4Add(StringBuffer list) { private void execP4Add(StringBuffer list) {
log("Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO); log("Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO);

execP4Command("-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler(this)); execP4Command("-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler(this));
} }
} }

Loading…
Cancel
Save