当前位置: 首页>>代码示例>>Java>>正文


Java SVNRevision.HEAD属性代码示例

本文整理汇总了Java中org.tigris.subversion.svnclientadapter.SVNRevision.HEAD属性的典型用法代码示例。如果您正苦于以下问题:Java SVNRevision.HEAD属性的具体用法?Java SVNRevision.HEAD怎么用?Java SVNRevision.HEAD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.tigris.subversion.svnclientadapter.SVNRevision的用法示例。


在下文中一共展示了SVNRevision.HEAD属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLogMessage

/**
 * Returns log message for given revision
 * @param client
 * @param file
 * @param revision
 * @return log message
 * @throws org.tigris.subversion.svnclientadapter.SVNClientException
 */
private static ISVNLogMessage getLogMessage (ISVNClientAdapter client, File file, long revision) throws SVNClientException {
    SVNRevision rev = SVNRevision.HEAD;
    ISVNLogMessage log = null;
    try {
        rev = SVNRevision.getRevision(String.valueOf(revision));
    } catch (ParseException ex) {
        Subversion.LOG.log(Level.WARNING, "" + revision, ex);
    }
    if (Subversion.LOG.isLoggable(Level.FINER)) {
        Subversion.LOG.log(Level.FINER, "{0}: getting last commit message for svn hooks", CommitAction.class.getName());
    }
    // log has to be called directly on the file
    final SVNUrl fileRepositoryUrl = SvnUtils.getRepositoryUrl(file);
    ISVNLogMessage[] ls = client.getLogMessages(fileRepositoryUrl, rev, rev);
    if (ls.length > 0) {
        log = ls[0];
    } else {
        Subversion.LOG.log(Level.WARNING, "no logs available for file {0} with repo url {1}", new Object[]{file, fileRepositoryUrl});
    }
    return log;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:CommitAction.java

示例2: browseRepositoryForRevision

private void browseRepositoryForRevision() {
    final SVNUrl repositoryUrl = getRepositoryUrl();

    String title = NbBundle.getMessage(RepositoryPaths.class, "CTL_BrowseTag"); // NOI18N
    RepositoryFile repoFile = new RepositoryFile(repositoryUrl, SVNRevision.HEAD);
    int mode = Browser.BROWSER_SINGLE_SELECTION_ONLY | Browser.BROWSER_SHOW_FILES | Browser.BROWSER_FOLDERS_SELECTION_ONLY;
    Browser browser = new Browser(title, mode, repoFile, null, null, Browser.BROWSER_HELP_ID_MERGE_TAG);
    final RepositoryFile[] repositoryFiles = browser.getRepositoryFiles();
    if(repositoryFiles == null || repositoryFiles.length == 0) {
        return;
    }
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            revisionTextField.setText(repositoryFiles[0].getRevision().toString());
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RepositoryPaths.java

示例3: revert

private void revert(File file, String revision) {
    final Context ctx = new Context(file);

    final SVNUrl url;
    try {
        url = SvnUtils.getRepositoryRootUrl(file);
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return;
    }
    final RepositoryFile repositoryFile = new RepositoryFile(url, url, SVNRevision.HEAD);

    final RevertModifications revertModifications = new RevertModifications(repositoryFile, revision);
    if(!revertModifications.showDialog()) {
        return;
    }

    RequestProcessor rp = Subversion.getInstance().getRequestProcessor(url);
    SvnProgressSupport support = new SvnProgressSupport() {
        @Override
        public void perform() {
            RevertModificationsAction.performRevert(revertModifications.getRevisionInterval(), revertModifications.revertNewFiles(), !revertModifications.revertRecursively(), ctx, this);
        }
    };
    support.start(rp, url, NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:AnnotationBar.java

示例4: testDiffSame

public void testDiffSame () throws Exception {
    // init
    File folder = new File(wc, "folder");
    File file = new File(folder, "file");
    folder.mkdirs();
    file.createNewFile();
    
    add(folder);
    commit(folder);
    
    RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/folder", SVNRevision.HEAD);
    RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/folder", SVNRevision.HEAD);
    final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder));
    final AtomicReference<Setup[]> ref = new AtomicReference<>();
    new SvnProgressSupport() {
        @Override
        protected void perform () {
            ref.set(revSupp.computeSetupsBetweenRevisions(this));
        }
    }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished();
    Setup[] setups = ref.get();
    assertNotNull(setups);
    assertEquals(0, setups.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:RevisionSetupSupportTest.java

示例5: parseUrlString

private void parseUrlString(String urlString) throws MalformedURLException {
    int idx = urlString.lastIndexOf('@');
    int hostIdx = urlString.indexOf("://");                         // NOI18N
    int firstSlashIdx = urlString.indexOf("/", hostIdx + 3);        // NOI18N
    if (urlString.contains("\\")) {
        throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_InvalidSvnUrl", urlString)); //NOI18N
    }
    if(idx < 0 || firstSlashIdx < 0 || idx < firstSlashIdx) {
        svnRevision = SVNRevision.HEAD;
    } else /*if (acceptRevision)*/ {
        if( idx + 1 < urlString.length()) {
            String revisionString = "";                             // NOI18N
            try {
                revisionString = urlString.substring(idx + 1);
                svnRevision = SvnUtils.getSVNRevision(revisionString);
            } catch (NumberFormatException ex) {
                throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_WrongRevision", revisionString));     // NOI18N
            }
        } else {
            svnRevision = SVNRevision.HEAD;
        }
        urlString = urlString.substring(0, idx);
    }
    SVNUrl normalizedUrl = removeEmptyPathSegments(new SVNUrl(urlString));
    if ("file".equals(normalizedUrl.getProtocol()) && normalizedUrl.getHost() != null //NOI18N
            && normalizedUrl.getPathSegments().length == 0) {
        throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_InvalidSvnUrl", SvnUtils.decodeToString(normalizedUrl))); //NOI18N
    }
    svnUrl = normalizedUrl;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:RepositoryConnection.java

示例6: getRevision

@Override
protected SVNRevision getRevision(Context ctx) {
    File[] roots = ctx.getRootFiles();
    SVNRevision revision = null;
    if(roots == null || roots.length == 0) return null;

    File interestingFile = roots[0];

    final SVNUrl rootUrl;
    final SVNUrl url;

    try {
        rootUrl = SvnUtils.getRepositoryRootUrl(interestingFile);
        url = SvnUtils.getRepositoryUrl(interestingFile);
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return null;
    }
    
    final RepositoryFile repositoryFile = new RepositoryFile(rootUrl, url, SVNRevision.HEAD);

    final UpdateTo updateTo = new UpdateTo(repositoryFile, Subversion.getInstance().getStatusCache().containsFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE, true));
    if(updateTo.showDialog()) {
        revision = updateTo.getSelectedRevision();
    }
    return revision;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:UpdateToAction.java

示例7: getRevision

public SVNRevision getRevision() {
    
    if (revisionTextField == null) {
        return SVNRevision.HEAD;
    }
    String revisionString = getRevisionString();

    if (revisionString.equals("")) {
        return SVNRevision.HEAD;
    }            
    return SvnUtils.getSVNRevision(revisionString);        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:RepositoryPaths.java

示例8: performContextAction

@Override
protected void performContextAction(final Node[] nodes) {
    
    if(!Subversion.getInstance().checkClientAvailable()) {            
        return;
    }
    
    Context ctx = getContext(nodes);        

    File[] roots = SvnUtils.getActionRoots(ctx);
    if(roots == null || roots.length == 0) return;

    File interestingFile;
    if(roots.length == 1) {
        interestingFile = roots[0];
    } else {
        interestingFile = SvnUtils.getPrimaryFile(roots[0]);
    }

    SVNUrl rootUrl = null, fileUrl = null;
    try {            
        rootUrl = SvnUtils.getRepositoryRootUrl(interestingFile);
        fileUrl = SvnUtils.getRepositoryUrl(interestingFile);
    } catch (SVNClientException ex) {
        if (rootUrl == null) {
            SvnClientExceptionHandler.notifyException(ex, true, true);
            return;
        }
    }
    final RepositoryFile repositoryFile = new RepositoryFile(rootUrl, fileUrl == null ? rootUrl : fileUrl, SVNRevision.HEAD);
    boolean hasChanges = Subversion.getInstance().getStatusCache().containsFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE, true);

    final RequestProcessor rp = createRequestProcessor(ctx);

    final SwitchTo switchTo = new SwitchTo(repositoryFile, interestingFile, hasChanges);
            
    performSwitch(switchTo, rp, nodes, roots);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:SwitchToAction.java

示例9: performContextAction

@Override
protected void performContextAction(final Node[] nodes) {
    
    if(!Subversion.getInstance().checkClientAvailable()) {            
        return;
    }
    
    Context ctx = getContext(nodes);

    final File[] roots = SvnUtils.getActionRoots(ctx);
    if(roots == null || roots.length == 0) return;
    File[] files = Subversion.getInstance().getStatusCache().listFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE);       
    
    File interestingFile;
    if(roots.length == 1) {
        interestingFile = roots[0];
    } else {
        interestingFile = SvnUtils.getPrimaryFile(roots[0]);
    }

    final SVNUrl repositoryUrl; 
    final SVNUrl fileUrl;        
    try {            
        repositoryUrl = SvnUtils.getRepositoryRootUrl(interestingFile); // XXX
        fileUrl = SvnUtils.getRepositoryUrl(interestingFile);
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return;
    }                   
    final RepositoryFile repositoryFile = new RepositoryFile(repositoryUrl, fileUrl, SVNRevision.HEAD);        

    final RequestProcessor rp = createRequestProcessor(ctx);
    final boolean hasChanges = files.length > 0;
    final CreateCopy createCopy = new CreateCopy(repositoryFile, interestingFile, hasChanges);

    performCopy(createCopy, rp, nodes, roots);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:CreateCopyAction.java

示例10: testDiffNoChange

public void testDiffNoChange () throws Exception {
    // init
    File trunk = new File(wc, "trunk");
    File folder = new File(trunk, "folder");
    File file = new File(folder, "file");
    folder.mkdirs();
    file.createNewFile();
    
    add(trunk);
    commit(trunk);
    
    RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder", SVNRevision.HEAD);
    RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder", SVNRevision.HEAD);
    getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true);
    
    final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder));
    final AtomicReference<Setup[]> ref = new AtomicReference<>();
    new SvnProgressSupport() {
        @Override
        protected void perform () {
            ref.set(revSupp.computeSetupsBetweenRevisions(this));
        }
    }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished();
    Setup[] setups = ref.get();
    assertNotNull(setups);
    assertEquals(0, setups.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:RevisionSetupSupportTest.java

示例11: testDiffModifiedFile

public void testDiffModifiedFile () throws Exception {
    // init
    File trunk = new File(wc, "trunk");
    File folder = new File(trunk, "folder");
    File file = new File(folder, "file");
    folder.mkdirs();
    file.createNewFile();
    
    add(trunk);
    commit(trunk);
    
    RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder", SVNRevision.HEAD);
    RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder", SVNRevision.HEAD);
    getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true);
    
    TestKit.write(file, "modification");
    commit(file);
    
    final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder));
    final AtomicReference<Setup[]> ref = new AtomicReference<>();
    new SvnProgressSupport() {
        @Override
        protected void perform () {
            ref.set(revSupp.computeSetupsBetweenRevisions(this));
        }
    }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished();
    Setup[] setups = ref.get();
    assertNotNull(setups);
    assertEquals(1, setups.length);
    assertEquals(file, setups[0].getBaseFile());
    assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[0].getInfo().getStatus());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:RevisionSetupSupportTest.java

示例12: testDiffModifiedDifferentNames

public void testDiffModifiedDifferentNames () throws Exception {
    // init
    File project = new File(wc, "project");
    File trunk = new File(project, "trunk");
    final File file = new File(trunk, "file");
    trunk.mkdirs();
    file.createNewFile();
    
    add(project);
    commit(project);
    
    RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/project/trunk", SVNRevision.HEAD);
    RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/project/branches/B", SVNRevision.HEAD);
    getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true);
    
    TestKit.write(file, "modification");
    commit(trunk);
    
    final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(new File[] { trunk }));
    final AtomicReference<Setup[]> ref = new AtomicReference<>();
    new SvnProgressSupport() {
        @Override
        protected void perform () {
            ref.set(revSupp.computeSetupsBetweenRevisions(this));
        }
    }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished();
    Setup[] setups = ref.get();
    assertNotNull(setups);
    assertEquals(1, setups.length);
    assertEquals(file, setups[0].getBaseFile());
    assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[0].getInfo().getStatus());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:RevisionSetupSupportTest.java

示例13: getLogMessages

@Override
public ISVNLogMessage[] getLogMessages(SVNUrl url, String[] paths, SVNRevision revStart, SVNRevision revEnd, boolean stopOnCopy, boolean fetchChangePath) throws SVNClientException {
    LogCommand cmd = new LogCommand(url, paths, revStart, revEnd, SVNRevision.HEAD, stopOnCopy, fetchChangePath, 0);
    return getLog(cmd);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CommandlineClient.java

示例14: performContextAction

@Override
protected void performContextAction(final Node[] nodes) {
    if(!Subversion.getInstance().checkClientAvailable()) {
        return;
    }
    final Context ctx = getContext(nodes);
    File[] roots = ctx.getRootFiles();
    // filter managed roots
    List<File> l = new ArrayList<>();
    for (File file : roots) {
        if(SvnUtils.isManaged(file)) {
            l.add(file);
        }
    }
    roots = l.toArray(new File[l.size()]);

    if(roots == null || roots.length == 0) return;

    File interestingFile;
    if(roots.length == 1) {
        interestingFile = roots[0];
    } else {
        interestingFile = SvnUtils.getPrimaryFile(roots[0]);
    }

    final SVNUrl rootUrl;
    final SVNUrl url;
    
    try {
        rootUrl = SvnUtils.getRepositoryRootUrl(interestingFile);
        url = SvnUtils.getRepositoryUrl(interestingFile);
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return;
    }
    final RepositoryFile repositoryFile = new RepositoryFile(rootUrl, url, SVNRevision.HEAD);
    
    final RevertModifications revertModifications = new RevertModifications(repositoryFile);
    if(!revertModifications.showDialog()) {
        return;
    }
    
    ContextAction.ProgressSupport support = new ContextAction.ProgressSupport(this, nodes, ctx) {
        @Override
        public void perform() {
            performRevert(revertModifications.getRevisionInterval(), revertModifications.revertNewFiles(), !revertModifications.revertRecursively(), ctx, this);
        }
    };
    support.start(createRequestProcessor(ctx));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:RevertModificationsAction.java

示例15: getRevision

protected SVNRevision getRevision (Context ctx) {
    return SVNRevision.HEAD;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:UpdateAction.java


注:本文中的org.tigris.subversion.svnclientadapter.SVNRevision.HEAD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。