package com.perforce.common.depot; import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.common.Stats; import com.perforce.common.StatsType; import com.perforce.common.client.Connection; import com.perforce.common.client.ConnectionFactory; import com.perforce.config.CFG; import com.perforce.config.CaseSensitivity; import com.perforce.config.Config; import com.perforce.config.ConfigException; import com.perforce.p4java.server.IOptionsServer; public class DepotImport implements DepotInterface { private Logger logger = LoggerFactory.getLogger(DepotImport.class); private String depotName; private String depotRoot; private String depotSub; private String depotPath; private String port; private String user; private String client; private String defaultClientRoot; private CaseSensitivity caseMode; private IOptionsServer iserver; public DepotImport(String name, CaseSensitivity mode) throws Exception { depotName = name; depotRoot = "//" + name; depotSub = (String) Config.get(CFG.P4_DEPOT_SUB); if (!depotSub.endsWith("/")) { depotSub = new String(depotSub + "/"); } if (!depotSub.startsWith("/")) { depotSub = new String("/" + depotSub); } depotPath = (String) Config.get(CFG.P4_ROOT); if (!depotPath.endsWith("/")) { depotPath = new String(depotPath + "/"); } caseMode = mode; port = (String) Config.get(CFG.P4_PORT); user = (String) Config.get(CFG.P4_USER); client = (String) Config.get(CFG.P4_CLIENT); defaultClientRoot = (String) Config.get(CFG.P4_CLIENT_ROOT); if (!defaultClientRoot.endsWith("/") && !defaultClientRoot.endsWith("\\")) { defaultClientRoot = new String(defaultClientRoot + "/"); Stats.inc(StatsType.warningCount); logger.info("Adding missing delimiter '/' or '\\' to end of Client path"); Config.set(CFG.P4_CLIENT_ROOT, defaultClientRoot); } // Initial connection Connection p4 = ConnectionFactory.getConnection(); iserver = p4.getIserver(); } @Override public String getClient() { return client; } @Override public long getDefaultDate() { // TODO Auto-generated method stub return 0; } @Override public String getUser() { // Not used (satisfy interface) return user; } @Override public String getName() { return depotName; } @Override public String getBase() { return depotRoot + depotSub; } @Override public String getRoot() throws ConfigException { return depotPath; } public String getPort() { return port; } public IOptionsServer getIServer() { // TODO: change interface? return iserver; } @Override public String getDefaultClientRoot() throws Exception { File file = new File(defaultClientRoot); return file.getCanonicalPath() + "/"; } public void setIServer(IOptionsServer ios) throws Exception { if (iserver != null) iserver.disconnect(); iserver = ios; } public CaseSensitivity getCaseMode() { return caseMode; } public int getServerVersion() { return iserver.getServerVersionNumber(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 13920 | Paul Allen | copy part 2 (no errors) | ||
#4 | 13776 | Paul Allen |
CVS: Update to node Action detection. The RCS State is normally set to 'Exp' and 'dead', but this change allows more user defined states. - Move Action class to common.node package. - Modified test case061 to test custom states. |
||
#3 | 12552 | Paul Allen |
Remove warning count on message: "Adding missing delimiter '/' or '\\' to end of Client path." |
||
#2 | 11071 | Paul Allen |
Path map translator for CVS and SVN paths. (undoc) To use create a path.map file with regex and group match. Only the first matching entry is used. The regex and group match are seperated by ', ' (or in regex terms ',\s+'). Lines starting with '#' are ignored. For example, 'trunk' is renamed to 'main', but other entries are left as-is. # path.map trunk/(.*), //import/main/{1} (.*), //import/{1} Note: if no file is found the default 'depot' and 'subPath' options are used to generate the map, preserving the original behaviour. CVS paths will always stat with the 'branch' name. 'main' for 1.1 and the symbol for other branches. # path.map main/projA/(.*), //import/projA/MAIN/{1} release_(.*)/projA/(.*), //import/projA/REL{1}/{2} (.*)/projA/(.*), //import/projA/TAG-{1}/{2} (.*), //import/unexpected/{1} Node: adding a catch all is a good idea. |
||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |