package com.perforce.cvs.parser; import java.io.ByteArrayOutputStream; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.perforce.cvs.parser.rcstypes.RcsObjectBlock; public class RcsDeltaAction { private RcsDeltaType action = RcsDeltaType.TEXT; private int line; private int length; private RcsObjectBlock block = new RcsObjectBlock(); public RcsDeltaAction(ByteArrayOutputStream buf) { //TODO may need to use a Charset for translation? String str = buf.toString(); Pattern r = Pattern.compile("^(a|d)(\\d+) (\\d+)$"); Matcher m = r.matcher(str); if (m.find()) { // set action if (m.group(1).contains("a")) action = RcsDeltaType.ADD; if (m.group(1).contains("d")) action = RcsDeltaType.DELETE; // set line and length line = Integer.parseInt(m.group(2)); length = Integer.parseInt(m.group(3)); } } public void addLine(ByteArrayOutputStream line) { block.add(line); } public RcsObjectBlock getBlock() { return block; } public RcsDeltaType getAction() { return action; } public int getLine() { return line; } public int getLength() { return length; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(action + ":" + line + ":" + length); return sb.toString(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13876 | Paul Allen | Rename/move file(s) | ||
//guest/paul_allen/p4convert-maven/src/com/perforce/cvs/parser/RcsDeltaAction.java | |||||
#1 | 13873 | Paul Allen | Branching using p4convert-maven | ||
//guest/perforce_software/p4convert/src/com/perforce/cvs/parser/RcsDeltaAction.java | |||||
#3 | 10957 | Paul Allen |
CVS parse RCS delta fix to regex. - added more debugging |
||
#2 | 10497 | Paul Allen |
New low-level RCS reader using a byte[] to manage CVS lines. Designed to help with the processing of BINARY data in RCS files. The line reading code still looks for a unix style '\n', but has a MAX LINE (hard coded to 10K). The RcsObjectBlock uses a ByteArrayOutputStream to store lines and parsers uses byte logic. (passes basic cvs/svn unit tests) |
||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |