package com.perforce.cvs.parser; 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(String str) { 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(String 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 | |
---|---|---|---|---|---|
#4 | 13920 | Paul Allen | copy part 2 (no errors) | ||
#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) |