org.tigris.subversion.svnclientadapter.SVNConflictDescriptor Java Examples

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNConflictDescriptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConflictHandlingWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private boolean showConflictEditorOption() {
	if (!fileExists(conflictDescriptor.getBasePath())) {
		return false;
	}
	if (conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.deleted || conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.moved_away) {
		return false;
	}
	if (conflictDescriptor.isBinary()) {
		File pathFile = new File(conflictDescriptor.getPath());
		try {
			MergeFileAssociation[] mergeFileAssociations = SVNUIPlugin.getPlugin().getMergeFileAssociations();
			if (mergeFileAssociations != null) {
				for (int i = 0; i < mergeFileAssociations.length; i++) {
					if (mergeFileAssociations[i].matches(pathFile.getName()) || mergeFileAssociations[i].getFileType().equals(pathFile.getName())) {
						return true;
					}
				}
			}
		} catch (Exception e) {}
		return false;
	}
	return true;
}
 
Example #2
Source File: JhlConverter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public static SVNConflictDescriptor convertConflictDescriptor(ConflictDescriptor d) {
	if (d == null) return null;
	SVNConflictVersion srcLeftVersion = null;
	if (d.getSrcLeftVersion() != null) {
		srcLeftVersion = new SVNConflictVersion(d.getSrcLeftVersion().getReposURL(), d.getSrcLeftVersion().getPegRevision(), d.getSrcLeftVersion().getPathInRepos(), d.getSrcLeftVersion().getNodeKind().ordinal());
	}
	SVNConflictVersion srcRightVersion = null;
	if (d.getSrcRightVersion() != null) {
		srcRightVersion = new SVNConflictVersion(d.getSrcRightVersion().getReposURL(), d.getSrcRightVersion().getPegRevision(), d.getSrcRightVersion().getPathInRepos(), d.getSrcRightVersion().getNodeKind().ordinal());
	}
	return new SVNConflictDescriptor(d.getPath(), d.getKind().ordinal(), d.getNodeKind().ordinal(),
			d.getPropertyName(), d.isBinary(),
            d.getMIMEType(), d.getAction().ordinal(), d.getReason().ordinal(), d.getOperation().ordinal(),
            srcLeftVersion, srcRightVersion,
            d.getBasePath(), d.getTheirPath(),
            d.getMyPath(), d.getMergedPath());
}
 
Example #3
Source File: DialogWizard.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void addPages() {
	super.addPages();
	if (type == FINISHED_EDITING) {
		setWindowTitle(Messages.DialogWizard_0);
		boolean propertyConflict = conflictDescriptor != null && conflictDescriptor.getConflictKind() == SVNConflictDescriptor.Kind.property;
		finishedEditingWizardPage = new FinishedEditingWizardPage("finishedEditing", propertyConflict); //$NON-NLS-1$
		addPage(finishedEditingWizardPage);
	}
	if (type == CONFLICT_HANDLING) {
		setWindowTitle(Messages.DialogWizard_1);
		conflictHandlingWizardPage = new ConflictHandlingWizardPage("handleConflict"); //$NON-NLS-1$
		conflictHandlingWizardPage.setConflictDescriptor(conflictDescriptor);
		conflictHandlingWizardPage.setResource(resources[0]);
		addPage(conflictHandlingWizardPage);
	}
	if (type == PROPERTY_VALUE_SELECTION) {
		setWindowTitle(Messages.DialogWizard_2);
		propertyValueSelectionWizardPage = new PropertyValueSelectionWizardPage("propertyValueSelection"); //$NON-NLS-1$
		propertyValueSelectionWizardPage.setConflictDescriptor(conflictDescriptor);
		propertyValueSelectionWizardPage.setMyValue(myValue);
		propertyValueSelectionWizardPage.setIncomingValue(incomingValue);
		propertyValueSelectionWizardPage.setResource(resources[0]);
		addPage(propertyValueSelectionWizardPage);
	}
}
 
Example #4
Source File: ResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void readFromVersion4Stream(StatusFromBytesStream dis) throws IOException {
	fileExternal = dis.readBoolean();
	treeConflicted = dis.readBoolean();
	if (treeConflicted) {
		int action = dis.readInt();
		int reason = dis.readInt();
		int operation = dis.readInt();
 
		String leftReposURL = dis.readString();
		long leftPegRevision = dis.readLong();
		String leftPathInRepos = dis.readString();
		int leftNodeKind = dis.readInt();
		SVNConflictVersion srcLeftVersion = new SVNConflictVersion(leftReposURL, leftPegRevision, leftPathInRepos, leftNodeKind);
		
		String rightReposURL = dis.readString();
		long rightPegRevision = dis.readLong();
		String rightPathInRepos = dis.readString();
		int rightNodeKind = dis.readInt();	
		SVNConflictVersion srcRightVersion = new SVNConflictVersion(rightReposURL, rightPegRevision, rightPathInRepos, rightNodeKind);
		
		conflictDescriptor = new SVNConflictDescriptor(url, action, reason, operation, srcLeftVersion, srcRightVersion);
	} else conflictDescriptor = null;
}
 
Example #5
Source File: SVNConflictResolver.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void finishEditing(SVNConflictDescriptor descrip) {
	DialogWizard dialogWizard = new DialogWizard(DialogWizard.FINISHED_EDITING);
	dialogWizard.setConflictDescriptor(descrip);
	ConflictWizardDialog dialog = new ConflictWizardDialog(Display.getDefault().getActiveShell(), dialogWizard);
	dialog.open();
	try {
		copyFile(workingTempFile, mergedFile);
	} catch (IOException e) {
		e.printStackTrace();
	}
	resolution = dialogWizard.getResolution();
	finished = true;			
}
 
Example #6
Source File: BuiltInEditConflictsAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public BuiltInEditConflictsAction(File conflictNewFile, File conflictOldFile, File conflictWorkingFile, File mergedFile, String fileName, SVNConflictDescriptor conflictDescriptor) {
	super();
	this.conflictNewFile = conflictNewFile;
	this.conflictOldFile = conflictOldFile;
	this.conflictWorkingFile = conflictWorkingFile;
	this.mergedFile = mergedFile;
	this.fileName = fileName;
	this.conflictDescriptor = conflictDescriptor;
}
 
Example #7
Source File: ConflictHandlingWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ConflictResolution getConflictResolution() {
	int resolution = ISVNConflictResolver.Choice.postpone;
	if (markConflictedButton.getSelection()) resolution = ISVNConflictResolver.Choice.postpone;
	else if (chooseIncomingVersionButton != null && chooseIncomingVersionButton.getSelection()) {
		if (conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.deleted || conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.moved_away) {
			resolution = ISVNConflictResolver.Choice.chooseMerged;
		}
		else {
			resolution = ISVNConflictResolver.Choice.chooseTheirsFull;
		}
	}
	else if (chooseIncomingVersionForConflictsButton != null && chooseIncomingVersionForConflictsButton.getSelection()) resolution = ISVNConflictResolver.Choice.chooseTheirs;
	else if (chooseUserVersionButton != null && chooseUserVersionButton.getSelection()) {
		if (conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.deleted || conflictDescriptor.getReason() == SVNConflictDescriptor.Reason.moved_away) {
			resolution = ISVNConflictResolver.Choice.chooseMine;
		}
		else {	
			resolution = ISVNConflictResolver.Choice.chooseMineFull;
		}
	}
	else if (chooseUserVersionForConflictsButton != null && chooseUserVersionForConflictsButton.getSelection()) resolution = ISVNConflictResolver.Choice.chooseMine;
	else if (chooseBaseVersionButton != null && chooseBaseVersionButton.getSelection()) resolution = ISVNConflictResolver.Choice.chooseBase;
    if (!conflictDescriptor.isBinary()) {
    	if (fileEditorButton != null && fileEditorButton.getSelection()) resolution = ConflictResolution.FILE_EDITOR;
    }
    if (conflictEditorButton != null && conflictEditorButton.getSelection()) resolution = ConflictResolution.CONFLICT_EDITOR;
    ConflictResolution conflictResolution = new ConflictResolution(conflictDescriptor, resolution);
    conflictResolution.setApplyToAll(applyToAllButton.getSelection());
	return conflictResolution;
}
 
Example #8
Source File: EntriesCache.java    From netbeans with Apache License 2.0 5 votes vote down vote up
SVNConflictDescriptor getConflictDescriptor (String fileName, String conflictsDescription) {
    SVNConflictDescriptor desc = null;
    if (conflictsDescription != null) {
        ParserConflictDescriptor[] conflicts = getConflicts(conflictsDescription);
        for (ParserConflictDescriptor conflict : conflicts) {
            if (fileName.equals(conflict.getFileName())) {
                desc = conflict;
                break;
            }
        }
    }
    return desc;
}
 
Example #9
Source File: EntriesCache.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Map<String, String> mergeThisDirAttributes(final boolean isDirectory, final String fileName, final EntryAttributes ea) {
    Map<String, String> attributes = ea.get(fileName);
    if(attributes == null) {
       attributes = new HashMap<String, String>();
       ea.put(fileName, attributes);
    }
    if (!ea.containsKey(SVN_THIS_DIR)) {
        return attributes;
    }
    for(Map.Entry<String, String> entry : ea.get(SVN_THIS_DIR).entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        if (WorkingCopyDetails.ATTR_TREE_CONFLICT_DESCRIPTOR.equals(key)) { // do not inherit this flag
            continue;
        } else if(isDirectory) {
            attributes.put(key, value);
        } else {
            if(key.equals("url")) {
                if( attributes.get(key) == null ) {
                    attributes.put(key, value + "/" + fileName);
                }
            } else if( key.equals("uuid") ||
                       key.equals("repos") ||
                       key.equals("revision") ||
                       key.equals(WorkingCopyDetails.VERSION_ATTR_KEY)) {
                if( attributes.get(key) == null ) {
                    attributes.put(key, value);
                }
            } else if (ATTR_TREE_CONFLICTS.equals(key)) { //NOI18N
                SVNConflictDescriptor desc = getConflictDescriptor(fileName, value);
                if (desc != null) {
                    attributes.put(WorkingCopyDetails.ATTR_TREE_CONFLICT_DESCRIPTOR, value);
                    attributes.put(WorkingCopyDetails.IS_HANDLED, ea.containsKey(fileName) && ea.get("deleted") == null ? "true" : "false");
                }
            }
        }
    }
    return attributes;
}
 
Example #10
Source File: EntriesCache.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void mergeDirWithParent (Map<String, String> folderAttributes, File folder) throws IOException, SAXException {
    Map<String, String> parentAttributes = getFileAttributes(folder.getParentFile(), false);
    if (parentAttributes != null) {
        String treeConflicts = parentAttributes.get(ATTR_TREE_CONFLICTS);
        String fileName = folder.getName();
        SVNConflictDescriptor desc = getConflictDescriptor(fileName, treeConflicts);
        if (desc != null) {
            folderAttributes.put(WorkingCopyDetails.ATTR_TREE_CONFLICT_DESCRIPTOR, treeConflicts); //NOI18
        } else {
            folderAttributes.remove(WorkingCopyDetails.ATTR_TREE_CONFLICT_DESCRIPTOR);
        }
    }
}
 
Example #11
Source File: ResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SVNConflictDescriptor getConflictDescriptor() {
	return conflictDescriptor;
}
 
Example #12
Source File: SVNTreeConflict.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public String getDescription() {
	String reason;
	String action;
	String operation;
	switch (status.getConflictDescriptor().getReason()) {
	case SVNConflictDescriptor.Reason.edited:
		reason = "edit"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Reason.obstructed:
		reason = "obstruction"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Reason.deleted:
		reason = "delete"; //$NON-NLS-1$
		break;		
	case SVNConflictDescriptor.Reason.missing:
		reason = "missing"; //$NON-NLS-1$
		break;	
	case SVNConflictDescriptor.Reason.unversioned:
		reason = "unversioned"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Reason.added:
		reason = "add"; //$NON-NLS-1$
		break;					
	default:
		reason = Integer.toString(status.getConflictDescriptor().getReason());
		break;
	}
	switch (status.getConflictDescriptor().getAction()) {
	case SVNConflictDescriptor.Action.edit:
		action = "edit"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Action.add:
		action = "add"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Action.delete:
		action = "delete"; //$NON-NLS-1$
		break;			
	default:
		action = Integer.toString(status.getConflictDescriptor().getAction());
		break;
	}
	switch (status.getConflictDescriptor().getOperation()) {
	case SVNConflictDescriptor.Operation._none:
		operation = "none"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Operation._update:
		operation = "update"; //$NON-NLS-1$
		break;
	case SVNConflictDescriptor.Operation._switch:
		operation = "switch"; //$NON-NLS-1$
		break;	
	case SVNConflictDescriptor.Operation._merge:
		operation = "merge"; //$NON-NLS-1$
		break;			
	default:
		operation = Integer.toString(status.getConflictDescriptor().getOperation());
		break;
	}				
	return "local " + reason + ", incoming " + action + " upon " + operation; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
 
Example #13
Source File: JhlStatus.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SVNConflictDescriptor getConflictDescriptor() {
	return JhlConverter.convertConflictDescriptor(conflictDescriptor);
}
 
Example #14
Source File: SVNTreeConflict.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SVNConflictDescriptor getConflictDescriptor() {
	return status.getConflictDescriptor();
}
 
Example #15
Source File: DefaultSVNConflictResolver.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
public SVNConflictResult resolve(SVNConflictDescriptor conflict) throws SVNClientException {
    log.warn("SVN conflict encountered at: " + conflict.getPath() + " - Executing default" +
            " resolution action - " + "\"choose-theirs-full\"");
    return new SVNConflictResult(SVNConflictResult.chooseTheirsFull, conflict.getMergedPath());
}
 
Example #16
Source File: ConflictResolution.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SVNConflictDescriptor getConflictDescriptor() {
	return conflictDescriptor;
}
 
Example #17
Source File: PropertyValueSelectionWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void setConflictDescriptor(SVNConflictDescriptor conflictDescriptor) {
	this.conflictDescriptor = conflictDescriptor;
}
 
Example #18
Source File: ConflictResolution.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public ConflictResolution(SVNConflictDescriptor conflictDescriptor, int resolution) {
	super();
	this.conflictDescriptor = conflictDescriptor;
	this.resolution = resolution;
}
 
Example #19
Source File: BuiltInConflictsCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public BuiltInConflictsCompareInput(CompareConfiguration configuration, SVNConflictDescriptor conflictDescriptor) {
	super(configuration);
	this.conflictDescriptor = conflictDescriptor;
}
 
Example #20
Source File: ParserSvnStatus.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public SVNConflictDescriptor getConflictDescriptor() {
    return conflictDescriptor;
}
 
Example #21
Source File: ConflictHandlingWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void setConflictDescriptor(SVNConflictDescriptor conflictDescriptor) {
	this.conflictDescriptor = conflictDescriptor;
}
 
Example #22
Source File: DialogWizard.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void setConflictDescriptor(SVNConflictDescriptor conflictDescriptor) {
	this.conflictDescriptor = conflictDescriptor;
}
 
Example #23
Source File: CLIStatus.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public SVNConflictDescriptor getConflictDescriptor() {
    return status.getConflictDescriptor();
}
 
Example #24
Source File: WorkingCopyDetails.java    From netbeans with Apache License 2.0 4 votes vote down vote up
SVNConflictDescriptor getConflictDescriptor() {
    return conflictDescriptor;
}
 
Example #25
Source File: WorkingCopyDetails.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static WorkingCopyDetails createWorkingCopy(File file, Map<String, String> attributes) {
    SVNConflictDescriptor conflictDescriptor = null;
    if (attributes != null) {
        conflictDescriptor = EntriesCache.getInstance().getConflictDescriptor(file.getName(), attributes.get(WorkingCopyDetails.ATTR_TREE_CONFLICT_DESCRIPTOR));
    }
    String version = attributes != null ? attributes.get(VERSION_ATTR_KEY) : VERSION_UNKNOWN;
    if(version != null) {
        if(version.equals(VERSION_13)) {

            return new WorkingCopyDetails(file, attributes, conflictDescriptor);
            
        } else if(version.equals(VERSION_14)) {
            
            return new WorkingCopyDetails(file, attributes, conflictDescriptor) {
                public boolean propertiesExist() throws IOException {
                    return getAttributes().containsKey("has-props");        // NOI18N
                }  
                public boolean propertiesModified() throws IOException {
                    return getAttributes().containsKey("has-prop-mods");    // NOI18N
                }            
                File getPropertiesFile() throws IOException {
                    if (propertiesFile == null) {
                        // unchanged properties have only the base file
                        boolean modified = getBooleanValue("has-prop-mods");                                // NOI18N
                        propertiesFile = SvnWcUtils.getPropertiesFile(getFile(), modified ? false : true);
                    }
                    return propertiesFile;
                }                    
            };

        } else if(version.equals(VERSION_UNKNOWN)) {

            WorkingCopyDetails wcd = new WorkingCopyDetails(file, attributes, conflictDescriptor);
            if(!wcd.isHandled()) {
                return wcd;
            } 
            // how is this possible?
            throw new UnsupportedOperationException("Unknown SVN working copy version: " + version);    // NOI18N                

        } else {

            throw new UnsupportedOperationException("Unknown SVN working copy version: " + version);    // NOI18N

        }   
    } else {
        Subversion.LOG.warning("Could not determine the SVN working copy version for " + file + ". Falling back on 1.3");  // NOI18N
        return new WorkingCopyDetails(file, attributes, conflictDescriptor);
    }
}
 
Example #26
Source File: WorkingCopyDetails.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of WorkingCopyDetails */
private WorkingCopyDetails(File file, Map<String, String> attributes, SVNConflictDescriptor conflictDescriptor) {
    this.file = file;
    this.attributes  = attributes;
    this.conflictDescriptor = conflictDescriptor;
}
 
Example #27
Source File: ISVNTreeConflict.java    From APICloud-Studio with GNU General Public License v3.0 votes vote down vote up
public SVNConflictDescriptor getConflictDescriptor();