package com.perforce.svn.prescan; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.config.CFG; import com.perforce.config.Config; import com.perforce.config.NodeFilterMap; import com.perforce.svn.parser.Record; import com.perforce.svn.parser.RecordReader; public class ExcludeParser { private static Logger logger = LoggerFactory.getLogger(ExcludeParser.class); private static NodeFilterMap exclude; private static NodeFilterMap include; private static NodeFilterMap issues; public static void preload(String line) throws Exception { exclude = new NodeFilterMap(); include = new NodeFilterMap(); issues = new NodeFilterMap(); exclude.add(line); } public static boolean load() throws Exception { String excludeFile = (String) Config.get(CFG.EXCLUDE_MAP); String includeFile = (String) Config.get(CFG.INCLUDE_MAP); String issueFile = (String) Config.get(CFG.ISSUE_MAP); exclude = new NodeFilterMap(excludeFile); boolean filter = exclude.load(); include = new NodeFilterMap(includeFile); include.load(); issues = new NodeFilterMap(issueFile); issues.clean(); return filter; } public static boolean parse(String dumpFile) throws Exception { if (logger.isInfoEnabled()) { logger.info("Verifying exclusion map..."); } long end = (Long) Config.get(CFG.P4_END); Progress progress = new Progress(end); // Open dump file reader and iterate over entries RecordReader recordReader = new RecordReader(dumpFile); for (Record record : recordReader) { switch (record.getType()) { case REVISION: progress.update(record.getSvnRevision()); break; case NODE: String toPath = record.findHeaderString("Node-path"); String fromPath = record.findHeaderString("Node-copyfrom-path"); // only add actions for paths that are not excluded if (!isSkipped(toPath)) { // check branch from path if (fromPath != null) { if (!isSkipped(fromPath)) { } else { issues.add(fromPath); if (logger.isInfoEnabled()) { logger.info("issue: " + fromPath); } } } } break; default: break; } if (progress.done()) { break; } } if (issues.isEmpty()) { if (logger.isInfoEnabled()) { logger.info("No issues found, ready to convert."); } return true; } else { if (logger.isInfoEnabled()) { logger.info("Issues found, saving issue map..."); } issues.store(); return false; } } /** * Returns true if node path is to be excluded * * @param path * @return */ public static boolean isSkipped(String path) { if (exclude.contains(path)) { if (include.contains(path)) { return false; } return true; } return false; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13876 | Paul Allen | Rename/move file(s) | ||
//guest/paul_allen/p4convert-maven/src/com/perforce/svn/prescan/ExcludeParser.java | |||||
#1 | 13873 | Paul Allen | Branching using p4convert-maven | ||
//guest/perforce_software/p4convert/src/com/perforce/svn/prescan/ExcludeParser.java | |||||
#3 | 12890 | Paul Allen |
Extended start/stop change limits to CVS. - Moved start and stop configuration options out of SVN name space to the generic P4 space. - Abstracted shared range logic to ProcessChange #review-12880 |
||
#2 | 11273 | Paul Allen |
SVN: Add --tag=n option to search for labels in the SVN data. Example use: java -jar p4convert.jar --type=SVN --repo=svn.dump --tags=2 Sample output: ... A:1 tags/1.0.4/ ... D:2 tags/7.04.3/ Key: A - Automatic label S - Static label D - Deleted label B - Branch :n - number of changes on path |
||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |