org.tigris.subversion.svnclientadapter.SVNRevision Java Examples

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNRevision. 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: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private ISVNProperty[] getPropertiesIncludingInherited(String path,
		boolean isFile) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.PROPLIST);
		notificationHandler.logCommandLine("proplist " + path);
		notificationHandler.setBaseDir();
		InheritedJhlProplistCallback callback = new InheritedJhlProplistCallback(
				isFile);
		Revision revision = null;
		if (!isFile) {
			revision = JhlConverter.convert(SVNRevision.HEAD);
		}
		svnClient.properties(path, revision, revision, Depth.empty, null,
				callback);
		return callback.getPropertyData();
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}
 
Example #2
Source File: CopyTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCopyURL2URLPrevRevision(String srcPath,
                                         String targetFileName) throws Exception {
    createAndCommitParentFolders(srcPath);
    File file = createFile(srcPath);
    write(file, 1);
    add(file);
    commit(file);
    SVNRevision prevRev = getRevision(file);
    write(file, 2);
    commit(getWC());

    File filecopy = createFile(renameFile(srcPath, targetFileName));
    filecopy.delete();

    ISVNClientAdapter c = getNbClient();
    c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", prevRev);

    ISVNLogMessage[] logs = getLog(getFileUrl(filecopy));
    assertEquals(((SVNRevision.Number)prevRev).getNumber() ,logs[0].getChangedPaths()[0].getCopySrcRevision().getNumber());

    InputStream is = getContent(getFileUrl(filecopy));
    assertContents(is, 1);
    assertNotifiedFiles(new File[] {});
}
 
Example #3
Source File: UpdateAction.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
       if (action != null && !action.isEnabled()) { 
       	action.setEnabled(true);
       } 
       else {
       	IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore();
        IResource[] resources = getSelectedResources(); 
        SVNConflictResolver conflictResolver = new SVNConflictResolver(resources[0], store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TEXT_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_BINARY_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_PROPERTIES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TREE_CONFLICTS));
       	UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, SVNRevision.HEAD);
    	updateOperation.setDepth(depth);
    	updateOperation.setSetDepth(setDepth);
    	updateOperation.setForce(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_ALLOW_UNVERSIONED_OBSTRUCTIONS));
    	updateOperation.setIgnoreExternals(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_IGNORE_EXTERNALS));
    	updateOperation.setCanRunAsJob(canRunAsJob);
    	updateOperation.setConflictResolver(conflictResolver);
       	updateOperation.run();
       } 		
}
 
Example #4
Source File: SvnClientJavaHl.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void merge(Path path, URL url, long revision, boolean recursivly, boolean recordOnly)
		throws SvnClientException {
	try {
		final SVNRevisionRange[] revisionRange = new SVNRevisionRange[] {
				new SVNRevisionRange(new Number(revision - 1), new Number(revision)) };
		client.merge(toSVNUrl(url), // SVN URL
				SVNRevision.HEAD, // pegRevision
				revisionRange, // revisions to merge (must be in the form N-1:M)
				path.toFile(), // target local path
				false, // force
				recursivly ? Depth.infinity : Depth.empty, // how deep to traverse into subdirectories
				false, // ignoreAncestry
				false, // dryRun
				recordOnly); // recordOnly
	} catch (MalformedURLException | SVNClientException e) {
		throw new SvnClientException(e);
	}
}
 
Example #5
Source File: SwitchToTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testSwitchToFile() throws Exception {                                        
    File file = createFile("file");
    add(file);
    commit(file);
            
    File filecopy = createFile("filecopy");
    
    ISVNClientAdapter c = getNbClient();
    c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", SVNRevision.HEAD);

    assertCopy(getFileUrl(filecopy));
    assertInfo(file, getFileUrl(file));
    
    c.switchToUrl(file, getFileUrl(filecopy), SVNRevision.HEAD, false);
    
    assertInfo(file, getFileUrl(filecopy));         
    assertNotifiedFiles();// XXX empty also in svnCA - why?! - no output from cli
}
 
Example #6
Source File: CopyTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCopyURL2FilePrevRevision(String srcPath,
                                          String targetFileName) throws Exception {
    createAndCommitParentFolders(srcPath);
    File file = createFile(srcPath);
    write(file, 1);
    add(file);
    commit(file);
    SVNRevision prevRev = getRevision(file);
    write(file, 2);
    commit(getWC());

    File filecopy = createFile(renameFile(srcPath, targetFileName));
    filecopy.delete();

    ISVNClientAdapter c = getNbClient();
    c.copy(getFileUrl(file), filecopy, prevRev);

    assertContents(filecopy, 1);
    if (isSvnkit()) {
        // svnkit does not notify about files
        assertNotifiedFiles(new File[] {});
    } else {
        assertNotifiedFiles(new File[] {filecopy});
    }
}
 
Example #7
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNProperty propertyGet(SVNUrl url, SVNRevision revision,
		SVNRevision peg, String propertyName) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.PROPGET);
		String target = url.toString();
		String commandLine = "propget -r " + revision.toString() + " "
				+ propertyName + " " + target;
		if (!peg.equals(SVNRevision.HEAD))
			commandLine += "@" + peg.toString();
		notificationHandler.logCommandLine(commandLine);
		notificationHandler.setBaseDir();
		byte[] bytes = svnClient.propertyGet(target, propertyName,
				JhlConverter.convert(revision), JhlConverter.convert(peg));
		if (bytes == null)
			return null;
		else
			return JhlPropertyData.newForUrl(target, propertyName, bytes);
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}
 
Example #8
Source File: CommitTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCommitFolder(String folderName, String fileName) throws Exception {
    File folder = createFolder(folderName);
    File file = createFile(folder, fileName);
            
    add(folder);               
    assertStatus(SVNStatusKind.ADDED, file);
    assertStatus(SVNStatusKind.ADDED, folder);

    SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl());
    
    ISVNClientAdapter client = getNbClient();        
    long r = client.commit(new File[] {folder}, "commit", true);
    
    SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl());
    
    assertTrue(file.exists());        
    assertStatus(SVNStatusKind.NORMAL, file);                
    assertStatus(SVNStatusKind.NORMAL, folder);                
    assertNotSame(revisionBefore, revisionAfter);
    assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r);
    assertNotifiedFiles(new File[] {file, folder});
    
}
 
Example #9
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNProperty[] getProperties(SVNUrl url, SVNRevision revision,
		SVNRevision pegRevision, boolean recurse) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.PROPLIST);
		String target = url.toString();
		notificationHandler.logCommandLine("proplist " + target);
		notificationHandler.setBaseDir();
		JhlProplistCallback callback = new JhlProplistCallback(false);
		Depth depth;
		if (recurse) {
			depth = Depth.infinity;
		} else {
			depth = Depth.empty;
		}
		svnClient.properties(target, JhlConverter.convert(revision),
				JhlConverter.convert(pegRevision), depth, null, callback);
		return callback.getPropertyData();
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}
 
Example #10
Source File: CommandlineClient.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public ISVNProperty[] getProperties(SVNUrl url, SVNRevision revision, SVNRevision pegRevision, boolean recursive) throws SVNClientException {
    ListPropertiesCommand cmd = new ListPropertiesCommand(url, revision.toString(), recursive);
    exec(cmd);
    List<String> names = cmd.getPropertyNames();
    List<ISVNProperty> props = new ArrayList<ISVNProperty>(names.size());
    for (String name : names) {
        ISVNProperty prop = propertyGet(url, name);
        if (prop != null) {
            props.add(prop);
        }
    }
    return props.toArray(new ISVNProperty[props.size()]);
}
 
Example #11
Source File: CatTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void testCatFile(String path) throws Exception {
    createAndCommitParentFolders(path);
    File file = createFile(path);
    write(file, 1);
    add(file);
    commit(file);

    InputStream is1 = getNbClient().getContent(file, SVNRevision.HEAD);
    InputStream is2 = new FileInputStream(file);

    assertInputStreams(is2, is1);
}
 
Example #12
Source File: SvnSearch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private SVNRevision getRevisionFrom() {
    String value = panel.dateFromTextField.getText().trim();
    if(value.equals("")) {
        return new SVNRevision.Number(1);
    }
    try {
        return new SVNRevision.DateSpec(DATE_FORMAT.parse(value));
    } catch (ParseException ex) {
        return null; // should not happen
    }
}
 
Example #13
Source File: Merge.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public SVNRevision getMergeStartRevision() {
    try {
        return mergeStartRepositoryPaths.getRepositoryFiles()[0].getRevision();
    } catch (MalformedURLException ex) {
        // should be already checked and
        // not happen at this place anymore
        Subversion.LOG.log(Level.INFO, null, ex);
    }
    return null;
}
 
Example #14
Source File: SvnWizardBranchTagPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public boolean performFinish() {
       if (projectProperties != null) {
           issue = issueText.getText().trim();
           if (projectProperties.isWarnIfNoIssue() && (issueText.getText().trim().length() == 0)) {
               if (!MessageDialog.openQuestion(getShell(), Policy.bind("BranchTagDialog.title"), Policy.bind("BranchTagDialog.0", projectProperties.getLabel()))) { //$NON-NLS-1$ //$NON-NLS-2$
                   issueText.setFocus();
                   return false;
               }
           }
           if (issueText.getText().trim().length() > 0) {
               String issueError = projectProperties.validateIssue(issueText.getText().trim());
               if (issueError != null) {
                   MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), issueError); //$NON-NLS-1$
                   issueText.selectAll();
                   issueText.setFocus();
                   return false;
               }
           }
       }        
       toUrlCombo.saveUrl();
       createOnServer = !workingCopyButton.getSelection();
       specificRevision = revisionButton.getSelection();
       makeParents = makeParentsButton.getSelection();
       if(switchAfterBranchTagCheckBox != null) {
       	switchAfterBranchTag = switchAfterBranchTagCheckBox.getSelection();
       }
       
       comment = commitCommentArea.getComment(true);
       if (serverButton.getSelection()) revision = SVNRevision.HEAD;
       try {
           toUrl = new SVNUrl(toUrlCombo.getText());
           if (revisionButton.getSelection()) revision = SVNRevision.getRevision(revisionText.getText().trim());
       } catch (Exception e) {
           MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage()); //$NON-NLS-1$
           return false;
       }
       if (resource != null) updateTagsProperty(toUrl);		
	return true;
}
 
Example #15
Source File: SwitchToUrlCommand.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public SwitchToUrlCommand(SVNWorkspaceRoot root, IResource resource, SVNUrl svnUrl, SVNRevision svnRevision) {
    super();
    this.root = root;
    this.resource = resource;
    this.svnUrl = svnUrl;
    this.svnRevision = svnRevision;
}
 
Example #16
Source File: HistoryDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void getLogEntries() {
   BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
        public void run() {
            try {
	            if (remoteResource == null) {
	                ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
					if ( localResource != null
					        && !localResource.getStatus().isAdded()
					        && localResource.getStatus().isManaged() ) {
					    remoteResource = localResource.getBaseResource();
					}
	            }
	            if (remoteResource != null) {
	            	if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
	            		tagManager = new AliasManager(remoteResource.getUrl());
					SVNRevision pegRevision = remoteResource.getRevision();
					SVNRevision revisionEnd = new SVNRevision.Number(0);
					boolean stopOnCopy = store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY);
					int entriesToFetch = store.getInt(ISVNUIConstants.PREF_LOG_ENTRIES_TO_FETCH);
					long limit = entriesToFetch;
					entries = getLogEntries(remoteResource, pegRevision, revisionStart, revisionEnd, stopOnCopy, limit + 1, tagManager);
					long entriesLength = entries.length;
					if (entriesLength > limit) {
						ILogEntry[] fetchedEntries = new ILogEntry[entries.length - 1];
						for (int i = 0; i < entries.length - 1; i++)
							fetchedEntries[i] = entries[i];
						entries = fetchedEntries;
					} else getNextEnabled = false;
					if (entries.length > 0) {
						ILogEntry lastEntry = entries[entries.length - 1];
						long lastEntryNumber = lastEntry.getRevision().getNumber();
						revisionStart = new SVNRevision.Number(lastEntryNumber - 1);
					}		
	            }
			} catch (TeamException e) {
				SVNUIPlugin.openError(Display.getCurrent().getActiveShell(), null, null, e);
			}	
        }       
   });
}
 
Example #17
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void diff(SVNUrl target, SVNRevision pegRevision,
		SVNRevision startRevision, SVNRevision endRevision, File outFile,
		int depth, boolean ignoreAncestry, boolean noDiffDeleted,
		boolean force) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);

		if (pegRevision == null)
			pegRevision = SVNRevision.HEAD;
		if (startRevision == null)
			startRevision = SVNRevision.HEAD;
		if (endRevision == null)
			endRevision = SVNRevision.HEAD;

		String commandLine = "diff ";
		Depth d = JhlConverter.depth(depth);
		commandLine += depthCommandLine(d);
		if (ignoreAncestry)
			commandLine += " --ignoreAncestry";
		commandLine += " -r " + startRevision + ":" + endRevision + " "
				+ target;
		notificationHandler.logCommandLine(commandLine);
		notificationHandler.setBaseDir();
		svnClient.diff(target.toString(),
				JhlConverter.convert(pegRevision),
				JhlConverter.convert(startRevision),
				JhlConverter.convert(endRevision), null,
				outFile.getAbsolutePath(), d, null, ignoreAncestry,
				noDiffDeleted, force, false);
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}
 
Example #18
Source File: RepositoryRevision.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public RepositoryRevision(ISVNLogMessage message, SVNUrl rootUrl, File[] selectionRoots,
        Map<String,File> pathToRoot, Map<String, SVNRevision> pegRevisions) {
    this.message = message;
    this.repositoryRootUrl = rootUrl;
    this.selectionRoots = selectionRoots;
    support = new PropertyChangeSupport(this);
    this.pathToRoot = pathToRoot;
    this.pegRevisions = pegRevisions;
    initFakeRootEvent();
}
 
Example #19
Source File: HistoryDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void getAllLogEntries() {
   BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
        public void run() {
            try {
	            if (remoteResource == null) {
	                ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
					if ( localResource != null
					        && !localResource.getStatus().isAdded()
					        && localResource.getStatus().isManaged() ) {
					    remoteResource = localResource.getBaseResource();
					}
	            }
	            if (remoteResource != null) {
	            	if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
	            		tagManager = new AliasManager(remoteResource.getUrl());
					SVNRevision pegRevision = remoteResource.getRevision();
					SVNRevision revisionEnd = new SVNRevision.Number(0);
					revisionStart = SVNRevision.HEAD;
					boolean stopOnCopy = store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY);
					long limit = 0;
					entries = getLogEntries(remoteResource, pegRevision, revisionStart, revisionEnd, stopOnCopy, limit, tagManager);
					if (getNextButton != null) getNextButton.setEnabled(false);	
	            }
			} catch (TeamException e) {
				SVNUIPlugin.openError(Display.getCurrent().getActiveShell(), null, null, e);
			}	
        }       
   });
   if (tableHistoryViewer != null) tableHistoryViewer.refresh();
}
 
Example #20
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public SVNDiffSummary[] diffSummarize(File path, SVNRevision pegRevision,
		SVNRevision startRevision, SVNRevision endRevision, int depth,
		boolean ignoreAncestry) throws SVNClientException {
	String target = fileToSVNPath(path, false);
	return this.diffSummarize(target, pegRevision, startRevision,
			endRevision, depth, ignoreAncestry);
}
 
Example #21
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private SVNRepositoryLocation(String user, String password, SVNUrl url, SVNUrl repositoryRootUrl) {
	this.user = user;
	this.url = url;
       this.repositoryRootUrl = repositoryRootUrl; 

	rootFolder = new RemoteFolder(this, url, SVNRevision.HEAD);
}
 
Example #22
Source File: SvnClientJavaHl.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String cat(URL url) throws SvnClientException {
	try {
		try (final InputStream content = client.getContent(toSVNUrl(url), SVNRevision.HEAD)) {
			return IOUtils.toString(content, StandardCharsets.UTF_8);
		}
	} catch (IOException | SVNClientException e) {
		throw new SvnClientException(e);
	}
}
 
Example #23
Source File: LogTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void logLimit(Log log) throws Exception {                                
    File file = createFile("file");
    add(file);
    write(file, "1");        
    commit(file, "msg1");
    ISVNInfo info1 = getInfo(file);        
    
    write(file, "2");
    commit(file, "msg2");
    ISVNInfo info2 = getInfo(file);
    
    write(file, "3");
    commit(file, "msg3");

    ISVNLogMessage[] logsNb = null;
    switch(log) {
        case file:
            logsNb = getNbClient().getLogMessages(file, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2);
            break;
        case url:
            logsNb = getNbClient().getLogMessages(getFileUrl(file), null, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2);
            break;
        default:
            fail("no idea!");
    }
    
    // test
    assertEquals(2, logsNb.length);         
    String testName = getName();        
    assertLogMessage(info1, logsNb[0], "msg1",  new ISVNLogMessageChangePath[] { new ChangePath('A', "/" + testName + "/" + testName + "_wc/file", null, null) });
    assertLogMessage(info2, logsNb[1], "msg2",  new ISVNLogMessageChangePath[] { new ChangePath('M', "/" + testName + "/" + testName + "_wc/file", null, null) });
}
 
Example #24
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private SVNDiffSummary[] diffSummarize(String target,
		SVNRevision pegRevision, SVNRevision startRevision,
		SVNRevision endRevision, int depth, boolean ignoreAncestry)
		throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);

		if (pegRevision == null)
			pegRevision = SVNRevision.HEAD;
		if (startRevision == null)
			startRevision = SVNRevision.HEAD;
		if (endRevision == null)
			endRevision = SVNRevision.HEAD;

		String commandLine = "diff --summarize";
		Depth d = JhlConverter.depth(depth);
		commandLine += depthCommandLine(d);
		if (ignoreAncestry)
			commandLine += " --ignoreAncestry";
		commandLine += " -r " + startRevision + ":" + endRevision + " "
				+ target;
		notificationHandler.logCommandLine(commandLine);
		notificationHandler.setBaseDir();
		JhlDiffSummaryReceiver callback = new JhlDiffSummaryReceiver();
		svnClient.diffSummarize(target, JhlConverter.convert(pegRevision),
				JhlConverter.convert(startRevision),
				JhlConverter.convert(endRevision), d, null, ignoreAncestry,
				callback);
		return callback.getDiffSummary();
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}
 
Example #25
Source File: RepositoryFile.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public RepositoryFile(SVNUrl repositoryUrl, SVNRevision revision) {
    assert repositoryUrl != null;        
    assert revision != null;
    
    this.repositoryUrl = repositoryUrl;
    this.revision = revision;
    repositoryRoot = true;
}
 
Example #26
Source File: UpdateDialogAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
       if (action != null && !action.isEnabled()) { 
       	action.setEnabled(true);
       } 
       else {
        IResource[] resources = getSelectedResources();         
        String pageName;
        if (resources.length > 1) pageName = "UpdateDialogWithConflictHandling.multiple"; //$NON-NLS-1$	
        else pageName = "UpdateDialogWithConflictHandling"; //$NON-NLS-1$	        
        SvnWizardUpdatePage updatePage = new SvnWizardUpdatePage(pageName, resources);
        updatePage.setDefaultRevision(revision);
        updatePage.setDepth(depth);
        updatePage.setSetDepth(setDepth);
        SvnWizard wizard = new SvnWizard(updatePage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        wizard.setParentDialog(dialog);
        if (dialog.open() == SvnWizardDialog.OK) {	  
        	SVNRevision svnRevision = updatePage.getRevision();
        	UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, svnRevision);
        	updateOperation.setDepth(updatePage.getDepth());
	    	updateOperation.setSetDepth(updatePage.isSetDepth());
	    	updateOperation.setForce(updatePage.isForce());
	    	updateOperation.setIgnoreExternals(updatePage.isIgnoreExternals());
	    	updateOperation.setCanRunAsJob(canRunAsJob);
	    	updateOperation.setConflictResolver(updatePage.getConflictResolver());
        	updateOperation.run();
        }
       } 		
}
 
Example #27
Source File: CommandlineClient.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public long commit(File[] files, String message, boolean keep, boolean recursive) throws SVNClientException {
    int retry = 0;
    CommitCommand cmd = null;
    while (true) {
        try {
            cmd = new CommitCommand(files, keep, recursive, message); // prevent cmd reuse
            exec(cmd);
            break;
        } catch (SVNClientException e) {
            if (e.getMessage().startsWith("svn: Attempted to lock an already-locked dir")) {
                Subversion.LOG.fine("ComandlineClient.comit() : " + e.getMessage());
                try {
                    retry++;
                    if (retry > 14) {
                        throw e;
                    }
                    Thread.sleep(retry * 50);
                } catch (InterruptedException ex) {
                    break;
                }
            } else {
                throw e;
            }
        }
    }
    return cmd != null ? cmd.getRevision() : SVNRevision.SVN_INVALID_REVNUM;
}
 
Example #28
Source File: JhlStatus.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public SVNRevision.Number getLastChangedRevision() {
       // we don't use 
       // return (SVNRevision.Number)JhlConverter.convert(_s.getLastChangedRevision());
       // as _s.getLastChangedRevision() is currently broken if revision is -1 
	if (lastChangedRevision != null)
		return lastChangedRevision;
	if (_s.getReposLastCmtAuthor() == null)
		return JhlConverter.convertRevisionNumber(_s.getLastChangedRevisionNumber());
	else
		if (_s.getReposLastCmtRevisionNumber() == 0)
			return null;
		return JhlConverter.convertRevisionNumber(_s.getReposLastCmtRevisionNumber());
}
 
Example #29
Source File: InteceptorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void cleanUpRepo() throws SVNClientException {
    ISVNClientAdapter client = getClient();
    ISVNDirEntry[] entries = client.getList(repoUrl, SVNRevision.HEAD, false);
    SVNUrl[] urls = new SVNUrl[entries.length];
    for (int i = 0; i < entries.length; i++) {
        urls[i] = repoUrl.appendPath(entries[i].getPath());            
    }        
    client.remove(urls, "cleanup");
}
 
Example #30
Source File: RevertModifications.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
RevertModifications.RevisionInterval getRevisionInterval() {                       
    SVNRevision revision1 = getRevision(startPath);
    SVNRevision revision2 = getRevision(endPath);
    if(revision1 == null || revision2 == null) {
        return null;
    }

    return getResortedRevisionInterval(revision1, revision2);            
}