special = !SVNFileUtil.symlinksSupported() ? false : fileType == SVNFileType.SYMLINK;
}
SVNTreeConflictDescription treeConflict = wcAccess.getTreeConflict(file);
if (entry == null) {
SVNStatus status = new SVNStatus(null, file, SVNNodeKind.UNKNOWN,
SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, null, null, SVNStatusType.STATUS_NONE,
SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, false,
false, false, false, null, null, null, null, null, SVNRevision.UNDEFINED, repositoryLock, null,
null, null, -1, treeConflict);
status.setRemoteStatus(SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, repositoryLock, SVNNodeKind.NONE);
SVNStatusType text = SVNStatusType.STATUS_NONE;
SVNFileType fileType = SVNFileType.getType(file);
if (fileType != SVNFileType.NONE) {
text = isIgnored ? SVNStatusType.STATUS_IGNORED : SVNStatusType.STATUS_UNVERSIONED;
}
if (fileType == SVNFileType.NONE && treeConflict != null) {
text = SVNStatusType.STATUS_MISSING;
}
status.setContentsStatus(text);
return status;
}
if (entry.getKind() == SVNNodeKind.DIR) {
if (fileKind == SVNNodeKind.DIR) {
if (wcAccess.isMissing(file)) {
textStatus = SVNStatusType.STATUS_OBSTRUCTED;
}
} else if (fileKind != SVNNodeKind.NONE) {
textStatus = SVNStatusType.STATUS_OBSTRUCTED;
}
}
if (entry.getExternalFilePath() != null) {
isFileExternal = true;
} else if (entry.getSVNURL() != null && parentEntry != null && parentEntry.getSVNURL() != null) {
String urlName = SVNPathUtil.tail(entry.getSVNURL().getURIEncodedPath());
if (!SVNEncodingUtil.uriEncode(file.getName()).equals(urlName)) {
isSwitched = true;
}
if (!isSwitched && !entry.getSVNURL().removePathTail().equals(parentEntry.getSVNURL())) {
isSwitched = true;
}
}
if (textStatus != SVNStatusType.STATUS_OBSTRUCTED) {
String name = entry.getName();
if (dir != null && dir.hasProperties(name)) {
propStatus = SVNStatusType.STATUS_NORMAL;
hasProps = true;
}
isPropsModified = dir != null && dir.hasPropModifications(name);
if (hasProps) {
isSpecial = !SVNFileUtil.isWindows && dir != null && dir.getProperties(name).getPropertyValue(SVNProperty.SPECIAL) != null;
}
if (entry.getKind() == SVNNodeKind.FILE && special == isSpecial) {
isTextModified = dir != null && dir.hasTextModifications(name, false);
}
if (isTextModified) {
textStatus = SVNStatusType.STATUS_MODIFIED;
}
if (isPropsModified) {
propStatus = SVNStatusType.STATUS_MODIFIED;
}
if (entry.getPropRejectFile() != null ||
entry.getConflictOld() != null || entry.getConflictNew() != null || entry.getConflictWorking() != null) {
if (dir != null && dir.hasTextConflict(name)) {
textStatus = SVNStatusType.STATUS_CONFLICTED;
}
if (dir != null && dir.hasPropConflict(name)) {
propStatus = SVNStatusType.STATUS_CONFLICTED;
}
}
if (entry.isScheduledForAddition() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
textStatus = SVNStatusType.STATUS_ADDED;
propStatus = SVNStatusType.STATUS_NONE;
} else if (entry.isScheduledForReplacement() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
textStatus = SVNStatusType.STATUS_REPLACED;
propStatus = SVNStatusType.STATUS_NONE;
} else if (entry.isScheduledForDeletion() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
textStatus = SVNStatusType.STATUS_DELETED;
propStatus = SVNStatusType.STATUS_NONE;
}
if (entry.isIncomplete() && textStatus != SVNStatusType.STATUS_DELETED && textStatus != SVNStatusType.STATUS_ADDED) {
textStatus = SVNStatusType.STATUS_INCOMPLETE;
} else if (fileKind == SVNNodeKind.NONE) {
if (textStatus != SVNStatusType.STATUS_DELETED) {
textStatus = SVNStatusType.STATUS_MISSING;
}
} else if (fileKind != entry.getKind()) {
textStatus = SVNStatusType.STATUS_OBSTRUCTED;
} else if ((!isSpecial && special) || (isSpecial && !special)) {
textStatus = SVNStatusType.STATUS_OBSTRUCTED;
}
if (fileKind == SVNNodeKind.DIR && entry.getKind() == SVNNodeKind.DIR) {
isLocked = wcAccess.isLocked(file);
}
}
if (!reportAll) {
if ((textStatus == SVNStatusType.STATUS_NONE || textStatus == SVNStatusType.STATUS_NORMAL) &&
(propStatus == SVNStatusType.STATUS_NONE || propStatus == SVNStatusType.STATUS_NORMAL) &&
!isLocked && !isSwitched && entry.getLockToken() == null && repositoryLock == null &&
entry.getChangelistName() == null && !isFileExternal && treeConflict == null) {
return null;
}
}
SVNLock localLock = null;
if (entry.getLockToken() != null) {
localLock = new SVNLock(null, entry.getLockToken(), entry.getLockOwner(), entry.getLockComment(),
SVNDate.parseDate(entry.getLockCreationDate()), null);
}
File conflictNew = dir != null ? dir.getFile(entry.getConflictNew()) : null;
File conflictOld = dir != null ? dir.getFile(entry.getConflictOld()) : null;
File conflictWrk = dir != null ? dir.getFile(entry.getConflictWorking()) : null;
File conflictProp = dir != null ? dir.getFile(entry.getPropRejectFile()) : null;
int wcFormatNumber = dir != null ? dir.getWorkingCopyFormatVersion() : -1;
SVNStatus status = new SVNStatus(entry.getSVNURL(), file, entry.getKind(),
SVNRevision.create(entry.getRevision()), SVNRevision.create(entry.getCommittedRevision()),
SVNDate.parseDate(entry.getCommittedDate()), entry.getAuthor(),
textStatus, propStatus, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE,
isLocked, entry.isCopied(), isSwitched, isFileExternal, conflictNew, conflictOld, conflictWrk, conflictProp,
entry.getCopyFromURL(), SVNRevision.create(entry.getCopyFromRevision()),
repositoryLock, localLock, entry.asMap(), entry.getChangelistName(), wcFormatNumber, treeConflict);
status.setEntry(entry);
return status;
}