use of org.apache.maven.scm.ScmFileStatus in project maven-scm by apache.
the class JazzListChangesetConsumer method processChangesLine.
private void processChangesLine(String line) {
// Process the changes line, eg:
// ---c- (1170) \GPDB\GPDBEAR\pom.xml
// ---c- (1171) \GPDB\GPDBResources\pom.xml
// ---c- (1167) \GPDB\GPDBWeb\pom.xml
// ---c- (1165) \GPDB\pom.xml
Matcher matcher = CHANGES_PATTERN.matcher(line);
if (matcher.find()) {
ChangeSet currentChangeSet = entries.get(currentChangeSetIndex);
// Not used.
String changeFlags = matcher.group(1);
String fileAlias = matcher.group(2);
String file = matcher.group(3);
if (getLogger().isDebugEnabled()) {
getLogger().debug(" Parsing Changes Line : " + line);
getLogger().debug(" changeFlags : " + changeFlags + " Translated to : " + parseFileChangeState(changeFlags));
getLogger().debug(" filetAlias : " + fileAlias);
getLogger().debug(" file : " + file);
}
ChangeFile changeFile = new ChangeFile(file);
ScmFileStatus status = parseFileChangeState(changeFlags);
changeFile.setAction(status);
currentChangeSet.getFiles().add(changeFile);
}
}
use of org.apache.maven.scm.ScmFileStatus in project maven-scm by apache.
the class JazzStatusConsumer method extractChangedFile.
private void extractChangedFile(String line) {
String flag = line.trim().substring(0, 2);
String filePath = line.trim().substring(3).trim();
ScmFileStatus status = ScmFileStatus.UNKNOWN;
if (STATUS_CMD_ADD_FLAG.equals(flag)) {
status = ScmFileStatus.ADDED;
}
if (STATUS_CMD_CHANGE_FLAG.equals(flag)) {
status = ScmFileStatus.MODIFIED;
}
if (STATUS_CMD_DELETE_FLAG.equals(flag)) {
status = ScmFileStatus.DELETED;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(" Extracted filePath : '" + filePath + "'");
getLogger().debug(" Extracted flag : '" + flag + "'");
getLogger().debug(" Extracted status : '" + status + "'");
}
fChangedFiles.add(new ScmFile(filePath, status));
}
use of org.apache.maven.scm.ScmFileStatus in project maven-scm by apache.
the class JazzUpdateConsumer method extractUpdatedFile.
private void extractUpdatedFile(String line) {
String filePath = "";
String flag = line.trim().substring(0, 3);
ScmFileStatus status = ScmFileStatus.UNKNOWN;
if (UPDATE_CMD_ADD_FLAG.equals(flag)) {
status = ScmFileStatus.ADDED;
filePath = line.trim().substring(4);
}
if (UPDATE_CMD_CHANGE_FLAG.equals(flag)) {
status = ScmFileStatus.UPDATED;
filePath = line.trim().substring(4);
}
if (UPDATE_CMD_DELETE_FLAG.equals(flag)) {
status = ScmFileStatus.DELETED;
filePath = line.trim().substring(4);
}
// be marked as deleted. (see if this is the case in RTC 3.0)
if (UPDATE_CMD_MOVED_FLAG.equals(flag)) {
status = ScmFileStatus.ADDED;
String pattern = "^" + UPDATE_CMD_MOVED_FLAG + "\\s(.*)\\s\\(moved\\sfrom\\s.*$";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(line.trim());
if (m.find()) {
filePath = m.group(1);
}
}
fUpdatedFiles.add(new ScmFile(filePath, status));
}
use of org.apache.maven.scm.ScmFileStatus in project maven-scm by apache.
the class SvnCheckOutConsumer method parseLine.
/**
* {@inheritDoc}
*/
protected void parseLine(String line) {
String statusString = line.substring(0, 1);
String file = line.substring(3).trim();
// [SCM-368]
if (file.startsWith(getWorkingDirectory().getAbsolutePath())) {
file = StringUtils.substring(file, getWorkingDirectory().getAbsolutePath().length() + 1);
}
ScmFileStatus status;
if (line.startsWith(CHECKED_OUT_REVISION_TOKEN)) {
String revisionString = line.substring(CHECKED_OUT_REVISION_TOKEN.length() + 1, line.length() - 1);
revision = parseInt(revisionString);
return;
} else if (statusString.equals("A")) {
status = ScmFileStatus.ADDED;
} else if (statusString.equals("U")) {
status = ScmFileStatus.UPDATED;
} else {
return;
}
addFile(new ScmFile(file, status));
}
use of org.apache.maven.scm.ScmFileStatus in project maven-scm by apache.
the class SvnMkdirConsumer method consumeLine.
/**
* {@inheritDoc}
*/
public void consumeLine(String line) {
if (StringUtils.isBlank(line)) {
return;
}
String statusString = line.substring(0, 1);
ScmFileStatus status;
if (line.startsWith(COMMITTED_REVISION_TOKEN)) {
String revisionString = line.substring(COMMITTED_REVISION_TOKEN.length() + 1, line.length() - 1);
revision = Integer.parseInt(revisionString);
return;
} else if (statusString.equals("A")) {
String file = line.substring(3);
status = ScmFileStatus.ADDED;
createdDirs.add(new ScmFile(file, status));
} else {
if (logger.isInfoEnabled()) {
logger.info("Unknown line: '" + line + "'");
}
return;
}
}
Aggregations