package com.perforce.svn.prescan; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.common.process.ProcessUser; import com.perforce.svn.change.ChangeParser; import com.perforce.svn.parser.Record; import com.perforce.svn.parser.RecordReader; public class SvnExtractUsers { private static Logger logger = LoggerFactory.getLogger(SvnExtractUsers.class); public static void store(String dumpFile, String filename) throws Exception { Map<String, String> users = new HashMap<String, String>(); RecordReader recordReader = new RecordReader(dumpFile); if (logger.isInfoEnabled()) { logger.info("Searching for users..."); } for (Record record : recordReader) { if (record.getType() == Record.Type.REVISION) { String user = ChangeParser.getSubversionUser(record); if (!users.containsKey(user)) { String clean = ProcessUser.filter(user); users.put(user, clean); } } } if (logger.isInfoEnabled()) { int u = users.size(); logger.info("Found " + u + " user(s)."); } FileOutputStream fs = new FileOutputStream(filename, false); BufferedOutputStream bs = new BufferedOutputStream(fs); DataOutputStream out = new DataOutputStream(bs); StringBuffer comment = new StringBuffer(); comment.append("# User translation map. (" + filename + ")\n"); comment.append("# Original Subversion user names are listed on the left-hand-side\n"); comment.append("# with the translation on the right-hand-side.\n"); comment.append("# Note: Perforce restricts the use of characters '@', '#', '*', '%' and '...'\n"); out.writeBytes(comment.toString()); for (String user : users.keySet()) { out.writeBytes(user + ", " + users.get(user) + "\n"); } out.flush(); out.close(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13876 | Paul Allen | Rename/move file(s) | ||
//guest/paul_allen/p4convert-maven/src/com/perforce/svn/prescan/SvnExtractUsers.java | |||||
#1 | 13873 | Paul Allen | Branching using p4convert-maven | ||
//guest/perforce_software/p4convert/src/com/perforce/svn/prescan/SvnExtractUsers.java | |||||
#1 | 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 |
||
//guest/perforce_software/p4convert/src/com/perforce/svn/prescan/ExtractUsers.java | |||||
#2 | 10636 | Paul Allen |
Added fix for CVS users with reserved chars in the name. CVS TestCase: username_comma, username_rev_chars |
||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |