📄 pvcs.java
字号:
} } finally { if (in != null) { in.close(); } } } /** * Simple hack to handle the PVCS command-line tools botch when * handling UNC notation. * @throws IOException if there is an error. */ private void massagePCLI(File in, File out) throws IOException { BufferedReader inReader = null; BufferedWriter outWriter = null; try { inReader = new BufferedReader(new FileReader(in)); outWriter = new BufferedWriter(new FileWriter(out)); String s = null; while ((s = inReader.readLine()) != null) { String sNormal = s.replace('\\', '/'); outWriter.write(sNormal); outWriter.newLine(); } } finally { if (inReader != null) { inReader.close(); } if (outWriter != null) { outWriter.close(); } } } /** * Get network name of the PVCS repository * @return String */ public String getRepository() { return repository; } /** * The filenameFormat attribute defines a MessageFormat string used * to parse the output of the pcli command. It defaults to * <code>{0}-arc({1})</code>. Repositories where the archive * extension is not -arc should set this. * @return the filename format attribute. */ public String getFilenameFormat() { return filenameFormat; } /** * The format of the folder names; optional. * This must be in a format suitable for * <code>java.text.MessageFormat</code>. * Index 1 of the format will be used as the file name. * Defaults to <code>{0}-arc({1})</code> * @param f the format to use. */ public void setFilenameFormat(String f) { filenameFormat = f; } /** * The lineStart attribute is used to parse the output of the pcli * command. It defaults to <code>"P:</code>. The parser already * knows about / and \\, this property is useful in cases where the * repository is accessed on a Windows platform via a drive letter * mapping. * @return the lineStart attribute. */ public String getLineStart() { return lineStart; } /** * What a valid return value from PVCS looks like * when it describes a file. Defaults to <code>"P:</code>. * If you are not using an UNC name for your repository and the * drive letter <code>P</code> is incorrect for your setup, you may * need to change this value, UNC names will always be * accepted. * @param l the value to use. */ public void setLineStart(String l) { lineStart = l; } /** * The network name of the PVCS repository; required. * @param repo String */ public void setRepository(String repo) { repository = repo; } /** * Get name of the project in the PVCS repository * @return String */ public String getPvcsproject() { return pvcsProject; } /** * The project within the PVCS repository to extract files from; * optional, default "/" * @param prj String */ public void setPvcsproject(String prj) { pvcsProject = prj; } /** * Get name of the project in the PVCS repository * @return Vector */ public Vector getPvcsprojects() { return pvcsProjects; } /** * Get name of the workspace to store the retrieved files * @return String */ public String getWorkspace() { return workspace; } /** * Workspace to use; optional. * By specifying a workspace, the files are extracted to that location. * A PVCS workspace is a name for a location of the workfiles and * isn't as such the location itself. * You define the location for a workspace using the PVCS GUI clients. * If this isn't specified the default workspace for the current user is used. * @param ws String */ public void setWorkspace(String ws) { workspace = ws; } /** * Get name of the PVCS bin directory * @return String */ public String getPvcsbin() { return pvcsbin; } /** * Specifies the location of the PVCS bin directory; optional if on the PATH. * On some systems the PVCS executables <i>pcli</i> * and <i>get</i> are not found in the PATH. In such cases this attribute * should be set to the bin directory of the PVCS installation containing * the executables mentioned before. If this attribute isn't specified the * tag expects the executables to be found using the PATH environment variable. * @param bin PVCS bin directory * @todo use a File setter and resolve paths. */ public void setPvcsbin(String bin) { pvcsbin = bin; } /** * Get value of force * @return String */ public String getForce() { return force; } /** * Specifies the value of the force argument; optional. * If set to <i>yes</i> all files that exists and are * writable are overwritten. Default <i>no</i> causes the files * that are writable to be ignored. This stops the PVCS command * <i>get</i> to stop asking questions! * @todo make a boolean setter * @param f String (yes/no) */ public void setForce(String f) { if (f != null && f.equalsIgnoreCase("yes")) { force = "yes"; } else { force = "no"; } } /** * Get value of promotiongroup * @return String */ public String getPromotiongroup() { return promotiongroup; } /** * Specifies the name of the promotiongroup argument * @param w String */ public void setPromotiongroup(String w) { promotiongroup = w; } /** * Get value of label * @return String */ public String getLabel() { return label; } /** * Only files marked with this label are extracted; optional. * @param l String */ public void setLabel(String l) { label = l; } /** * Get value of revision * @return String */ public String getRevision() { return revision; } /** * Only files with this revision are extract; optional. * @param r String */ public void setRevision(String r) { revision = r; } /** * Get value of ignorereturncode * @return String */ public boolean getIgnoreReturnCode() { return ignorerc; } /** * If set to true the return value from executing the pvcs * commands are ignored; optional, default false. * @param b a <code>boolean</code> value. */ public void setIgnoreReturnCode(boolean b) { ignorerc = b; } /** * Specify a project within the PVCS repository to extract files from. * @param p the pvcs project to use. */ public void addPvcsproject(PvcsProject p) { pvcsProjects.addElement(p); } /** * get the updateOnly attribute. * @return the updateOnly attribute. */ public boolean getUpdateOnly() { return updateOnly; } /** * If set to <i>true</i> files are fetched only if * newer than existing local files; optional, default false. * @param l a <code>boolean</code> value. */ public void setUpdateOnly(boolean l) { updateOnly = l; } /** * returns the path of the configuration file to be used * @return the path of the config file */ public String getConfig() { return config; } /** * Sets a configuration file other than the default to be used. * These files have a .cfg extension and are often found in archive or pvcsprop folders. * @param f config file - can be given absolute or relative to ant basedir */ public void setConfig(File f) { config = f.toString(); } /** * Get the userid. * @return the userid. */ public String getUserId() { return userId; } /** * User ID * @param u the value to use. */ public void setUserId(String u) { userId = u; } /** * Creates a Pvcs object */ public Pvcs() { super(); pvcsProject = null; pvcsProjects = new Vector(); workspace = null; repository = null; pvcsbin = null; force = null; promotiongroup = null; label = null; ignorerc = false; updateOnly = false; lineStart = "\"P:"; filenameFormat = "{0}-arc({1})"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -