Example usage for org.eclipse.jgit.lib AbbreviatedObjectId isId

List of usage examples for org.eclipse.jgit.lib AbbreviatedObjectId isId

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib AbbreviatedObjectId isId.

Prototype

public static final boolean isId(String id) 

Source Link

Document

Test a string of characters to verify it is a hex format.

Usage

From source file:com.google.gitiles.Revision.java

License:Open Source License

public boolean nameIsId() {
    return AbbreviatedObjectId.isId(name) && (AbbreviatedObjectId.fromString(name).prefixCompare(id) == 0);
}

From source file:com.madgag.agit.BlobViewerActivity.java

License:Open Source License

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        String revision = getIntent().getStringExtra(REVISION);

        Intent intent = AbbreviatedObjectId.isId(revision)
                ? commitViewIntentFor(getIntent().getExtras()).toIntent()
                : branchViewerIntentFor(gitdir(), revision);
        return homewardsWith(this, intent);
    }/*from  w  w w. java 2  s . c  om*/
    return super.onOptionsItemSelected(item);
}

From source file:com.microsoft.gittf.core.util.CommitUtil.java

License:Open Source License

/**
 * Returns the commit object id that is pointed at by the ref specified
 * /*  w  ww  .j av  a  2  s.c  om*/
 * @param repository
 *        the git repository
 * @param ref
 *        the reference name
 * @return
 * @throws Exception
 */
public static ObjectId getRefNameCommitID(final Repository repository, String ref) throws Exception {
    if (AbbreviatedObjectId.isId(ref) || ObjectId.isId(ref)) {
        return peelRef(repository, repository.resolve(ref));
    }

    return getCommitId(repository, ref);
}

From source file:com.tasktop.c2c.server.scm.service.GitServiceBean.java

License:Open Source License

@Override
public Commit getCommitWithDiff(String repositoryName, String commitId, Integer context)
        throws EntityNotFoundException {
    try {/*from  w ww  . j  a  v  a2  s  .com*/
        Repository jgitRepo = findRepositoryByName(repositoryName);

        if (context != null && context == -2 && commitId.length() <= 40 && AbbreviatedObjectId.isId(commitId)) {
            return GitBrowseUtil.resolveCommit(jgitRepo, commitId);
        }

        return getCommitInternal(repositoryName, jgitRepo, commitId, context);
    } catch (IOException e) {
        throw new RuntimeException(e);
    } catch (GitAPIException e) {
        throw new RuntimeException(e);
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
}