package com.perforce.svndump.prescan; import java.io.File; import org.junit.Assert; import org.junit.Test; import com.perforce.Main; import com.perforce.common.ExitCode; import com.perforce.config.CFG; import com.perforce.config.Config; import com.perforce.config.ScmType; public class TestUsage { private final static String dumpPath = "test/com/perforce/integration/dumps/"; private final static String dumpFile = "repo.dump"; @Test public void test_MainFlagUsage() throws Exception { File file = new File("default.cfg"); file.delete(); // generate default configuration file String args[] = { "--type=SVN", "--default" }; ExitCode code = Main.processArgs(args); boolean test = (!file.isDirectory() && file.canRead()); Assert.assertEquals(true, test); Assert.assertEquals(ExitCode.OK, code); } @Test public void test_MainFlagInfo() throws Exception { // pass --info to scan SVN dump file String testcase = dumpPath + "add-del-br-del-br/" + dumpFile; String args[] = { "--type=SVN", "--info", "--repo=" + testcase }; ExitCode code = Main.processArgs(args); Assert.assertEquals(ExitCode.OK, code); } @Test public void test_MainFlagRun() throws Exception { File config = new File("test.cfg"); Config.setDefault(); Config.set(CFG.SCM_TYPE, ScmType.SVN); Config.set(CFG.P4_MODE, "CONVERT"); Config.set(CFG.P4_ROOT, "./p4_root/"); Config.set(CFG.SVN_DUMPFILE, dumpPath + "add-del-br-del-br/" + dumpFile); Config.store(config.getName(), ScmType.SVN); // pass config file to run conversion String args[] = { "--config=" + config.getName() }; ExitCode code = Main.processArgs(args); // clean up test file config.delete(); Assert.assertEquals(ExitCode.OK, code); } @Test public void test_MainFlagRun_EXCEPTION() throws Exception { File config = new File("test.cfg"); Config.setDefault(); Config.set(CFG.SCM_TYPE, ScmType.SVN); Config.set(CFG.P4_MODE, "IMPORT"); Config.set(CFG.P4_PORT, ""); Config.set(CFG.P4_ROOT, ""); Config.set(CFG.P4_CLIENT_ROOT, ""); Config.set(CFG.SVN_DUMPFILE, dumpPath + "add-del-br-del-br/" + dumpFile); Config.store(config.getName(), ScmType.SVN); // pass config file to run conversion String args[] = { "--config=" + config.getName() }; ExitCode code = Main.processArgs(args); // clean up test file config.delete(); Assert.assertEquals(ExitCode.EXCEPTION, code); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12446 | Paul Allen | Branching using p4convert-rusty | ||
//guest/perforce_software/p4convert/test/com/perforce/svndump/prescan/TestUsage.java | |||||
#4 | 11762 | Paul Allen |
Modified the --default flag to generate default entries for the client root and server root. - Moved Main.java out of SVN package. |
||
#3 | 11186 | Paul Allen |
Support standard command line arguments. Important change please note... @rjackson @nmorse The change was needed to extend the current features like --info and --user for CVS and future SCM support. Please check the documentation and CLI usage for the new usage. - CVS support for --users - Unit tests for CLI arguments Example: standard usage. java -jar p4convert.jar --config=myFile.cfg Example: generate a CVS configuration file. java -jar p4convert.jar --type=CVS --default Example: report Subversion repository usage. java -jar p4convert.jar --type=SVN --repo=/path/to/repo.dump --info |
||
#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) |