modifiedProps.containsKey(SVNProperty.KEYWORDS) ||
modifiedProps.containsKey(SVNProperty.EOL_STYLE) ||
modifiedProps.containsKey(SVNProperty.SPECIAL);
}
SVNVersionedProperties baseProps = adminArea.getBaseProperties(name);
Map oldBaseProps = baseProps != null ? baseProps.asMap() : null;
SVNStatusType propStatus = adminArea.mergeProperties(name, oldBaseProps, modifiedProps, true, false, log);
if (modifiedEntryProps != null) {
lockStatus = log.logChangedEntryProperties(name, modifiedEntryProps);
}
boolean isLocalPropsModified = !myCurrentFile.IsAdded && adminArea.hasPropModifications(name);
if (modifiedProps != null && !isLocalPropsModified) {
command.put(SVNLog.NAME_ATTR, name);
command.put(SVNProperty.shortPropertyName(SVNProperty.PROP_TIME), SVNLog.WC_TIMESTAMP);
log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
command.clear();
}
if (modifiedWCProps != null) {
log.logChangedWCProperties(name, modifiedWCProps);
}
boolean isReplaced = false;
boolean useRevertBase = false;
if (!isLocallyModified) {
SVNEntry entry = adminArea.getEntry(name, false);
if (entry != null && entry.isScheduledForReplacement()) {
isReplaced = true;
}
if (isReplaced && entry.getCopyFromURL() != null) {
useRevertBase = true;
}
}
//merge contents.
String adminDir = SVNFileUtil.getAdminDirectoryName();
File textTmpBase;
if (useRevertBase) {
textTmpBase = adminArea.getFile(SVNAdminUtil.getTextRevertPath(name, true));
} else {
textTmpBase = adminArea.getBaseFile(name, true);
}
File workingFile = adminArea.getFile(name);
String tmpPath = null;
String basePath = null;
if (myCurrentFile.TextUpdated && textTmpBase.exists()) {
if (!isReplaced) {
tmpPath = adminDir + "/tmp/text-base/" + name + ".svn-base";
basePath = adminDir + "/text-base/" + name + ".svn-base";
} else {
tmpPath = adminDir + "/tmp/text-base/" + name + ".svn-revert";
basePath = adminDir + "/text-base/" + name + ".svn-revert";
}
} else if (!myCurrentFile.TextUpdated && magicPropsChanged && workingFile.exists()) {
// only props were changed, but we have to retranslate file.
// only if wc file exists (may be locally deleted), otherwise no
// need to retranslate...
tmpPath = SVNAdminUtil.getTextBasePath(name, true);
command.put(SVNLog.NAME_ATTR, name);
command.put(SVNLog.DEST_ATTR, tmpPath);
log.addCommand(SVNLog.COPY_AND_DETRANSLATE, command, false);
command.clear();
command.put(SVNLog.NAME_ATTR, tmpPath);
command.put(SVNLog.DEST_ATTR, name);
log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
command.clear();
}
// update entry.
command.put(SVNLog.NAME_ATTR, name);
command.put(SVNProperty.shortPropertyName(SVNProperty.KIND), SVNProperty.KIND_FILE);
command.put(SVNProperty.shortPropertyName(SVNProperty.REVISION), Long.toString(myTargetRevision));
command.put(SVNProperty.shortPropertyName(SVNProperty.DELETED), Boolean.FALSE.toString());
command.put(SVNProperty.shortPropertyName(SVNProperty.ABSENT), Boolean.FALSE.toString());
if (myCurrentFile.URL != null) {
command.put(SVNProperty.shortPropertyName(SVNProperty.URL), myCurrentFile.URL);
}
log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
command.clear();
if (myCurrentFile.TextUpdated && textTmpBase.exists()) {
textStatus = SVNStatusType.CHANGED;
// there is a text replace working copy with.
if (!isLocallyModified && !isReplaced) {
command.put(SVNLog.NAME_ATTR, tmpPath);
command.put(SVNLog.DEST_ATTR, name);
log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
command.clear();
} else {
SVNFileType kind = SVNFileType.getType(workingFile);
if (kind == SVNFileType.NONE) {
command.put(SVNLog.NAME_ATTR, tmpPath);
command.put(SVNLog.DEST_ATTR, name);
log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
command.clear();
} else {
SVNEntry entry = adminArea.getEntry(name, false);
if (entry == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNVERSIONED_RESOURCE, "''{0}'' is not under version control", workingFile);
SVNErrorManager.error(err);
}
// do test merge.
String oldEolStyle = null;
String oldKeywords = null;
SVNVersionedProperties props = adminArea.getProperties(myCurrentFile.Name);
try {
if (magicPropsChanged &&
(modifiedProps.containsKey(SVNProperty.EOL_STYLE) || modifiedProps.containsKey(SVNProperty.KEYWORDS))) {
// use new valuse to let dry-run merge use the same input as real merge will use.
oldKeywords = props.getPropertyValue(SVNProperty.KEYWORDS);
oldEolStyle = props.getPropertyValue(SVNProperty.EOL_STYLE);
props.setPropertyValue(SVNProperty.EOL_STYLE, (String) modifiedProps.get(SVNProperty.EOL_STYLE));
props.setPropertyValue(SVNProperty.KEYWORDS, (String) modifiedProps.get(SVNProperty.KEYWORDS));
}
textStatus = adminArea.mergeText(name, adminArea.getFile(basePath), adminArea.getFile(tmpPath), "", "", "", myIsLeaveConflicts, true);
} finally {
if (magicPropsChanged &&
(modifiedProps.containsKey(SVNProperty.EOL_STYLE) || modifiedProps.containsKey(SVNProperty.KEYWORDS))) {
// restore original values.
props.setPropertyValue(SVNProperty.EOL_STYLE, oldEolStyle);
props.setPropertyValue(SVNProperty.KEYWORDS, oldKeywords);
}
}
if (textStatus == SVNStatusType.UNCHANGED) {
textStatus = SVNStatusType.MERGED;
}