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 | |
---|---|---|---|---|---|
#1 | 10152 | alan_petersen |
Populate //guest/alan_petersen/p4convert/... from //guest/perforce_software/p4convert/.... |
||
//guest/perforce_software/p4convert/src/com/perforce/cvs/parser/RcsDeltaAction.java | |||||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |