本文整理汇总了Java中org.eclipse.egit.github.core.CommitFile类的典型用法代码示例。如果您正苦于以下问题:Java CommitFile类的具体用法?Java CommitFile怎么用?Java CommitFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommitFile类属于org.eclipse.egit.github.core包,在下文中一共展示了CommitFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
public void process(Exchange exchange) throws Exception {
CommitFile file = exchange.getIn().getBody(CommitFile.class);
Blob response = dataService.getBlob(getRepository(), file.getSha());
String text = response.getContent();
// By default, if blob encoding is base64 then we convert to UTF-8. If
// base64 encoding is required, then must be explicitly requested
if (response.getEncoding().equals(Blob.ENCODING_BASE64)
&& encoding != null && encoding.equalsIgnoreCase(Blob.ENCODING_UTF8)) {
text = new String(Base64.decodeBase64(text));
}
// copy the header of in message to the out message
exchange.getOut().copyFrom(exchange.getIn());
exchange.getOut().setBody(text);
}
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:GetCommitFileProducer.java
示例2: testPullRequestFilesProducer
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Test
public void testPullRequestFilesProducer() throws Exception {
PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestFilesProducer");
latestPullRequestNumber = pullRequest.getNumber();
CommitFile file = new CommitFile();
file.setFilename("testfile");
List<CommitFile> commitFiles = new ArrayList<CommitFile>();
commitFiles.add(file);
pullRequestService.setFiles(latestPullRequestNumber, commitFiles);
Endpoint filesProducerEndpoint = getMandatoryEndpoint("direct:validPullRequest");
Exchange exchange = filesProducerEndpoint.createExchange();
Exchange resp = template.send(filesProducerEndpoint, exchange);
assertEquals(resp.getOut().getBody(), commitFiles);
}
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:PullRequestFilesProducerTest.java
示例3: transformToFileDetails
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
public static List<ChangesetFileDetail> transformToFileDetails(List<CommitFile> files)
{
if (files == null)
{
return Collections.emptyList();
}
return ImmutableList.copyOf(Lists.transform(files, new Function<CommitFile, ChangesetFileDetail>()
{
@Override
public ChangesetFileDetail apply(CommitFile commitFile)
{
String filename = commitFile.getFilename();
String status = commitFile.getStatus();
int additions = commitFile.getAdditions();
int deletions = commitFile.getDeletions();
return new ChangesetFileDetail(CustomStringUtils.getChangesetFileAction(status), filename, additions, deletions);
}
}));
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GithubChangesetFactory.java
示例4: getItemId
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Override
public long getItemId(int position) {
switch (getItemViewType(position)) {
case TYPE_FILE_HEADER:
String sha = ((CommitFile) getItem(position)).getSha();
if (!TextUtils.isEmpty(sha))
return sha.hashCode();
else
return super.getItemId(position);
case TYPE_COMMENT:
case TYPE_LINE_COMMENT:
return ((CommitComment) getItem(position)).getId();
default:
return super.getItemId(position);
}
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:CommitFileListAdapter.java
示例5: setFiles
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
/**
* Set files to styler
*
* @param files
* @return this styler
*/
public DiffStyler setFiles(final Collection<CommitFile> files) {
diffs.clear();
if (files == null || files.isEmpty())
return this;
for (CommitFile file : files) {
String patch = file.getPatch();
if (TextUtils.isEmpty(patch))
continue;
int start = 0;
int length = patch.length();
int end = nextLine(patch, start, length);
List<CharSequence> lines = new ArrayList<CharSequence>();
while (start < length) {
lines.add(patch.substring(start, end));
start = end + 1;
end = nextLine(patch, start, length);
}
diffs.put(file.getFilename(), lines);
}
return this;
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:30,代码来源:DiffStyler.java
示例6: createLinePositioners
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
private Map<String, LinePositioner> createLinePositioners() throws IOException {
List<CommitFile> files = pullRequestService.getFiles( repository, pullRequestId );
Map<String, LinePositioner> linePositioners = Maps.newLinkedHashMap();
for (CommitFile commitFile : files) {
if (commitFile.getPatch() == null)
continue;
LinePositioner positioner;
if ("added".equals( commitFile.getStatus() ))
positioner = new OneToOneLinePositioner();
else
positioner = new PatchLinePositioner( commitFile.getPatch() );
linePositioners.put( commitFile.getFilename(), positioner );
}
return linePositioners;
}
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:19,代码来源:SonarPullRequestMojo.java
示例7: testGitHubComponent
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Test
public void testGitHubComponent() throws Exception {
String oauthKey = System.getenv("CAMEL_GITHUB_OAUTH_KEY");
Assume.assumeNotNull("CAMEL_GITHUB_OAUTH_KEY not null", oauthKey);
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.toF("github:GETCOMMITFILE?oauthToken=%s&repoOwner=%s&repoName=%s", oauthKey, GITHUB_REPO_OWNER, GITHUB_REPO_NAME);
}
});
camelctx.start();
try {
CommitFile commitFile = new CommitFile();
commitFile.setSha("29222e8ccbb39c3570aa1cd29388e737a930a88d");
ProducerTemplate template = camelctx.createProducerTemplate();
String result = template.requestBody("direct:start", commitFile, String.class);
Assert.assertEquals("Hello Kermit", result.trim());
} finally {
camelctx.stop();
}
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:27,代码来源:GitHubIntegrationTest.java
示例8: process
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
public void process(Exchange exchange) throws Exception {
Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", Integer.class);
java.util.List<CommitFile> response = pullRequestService.getFiles(getRepository(), pullRequestNumber);
// copy the header of in message to the out message
exchange.getOut().copyFrom(exchange.getIn());
exchange.getOut().setBody(response);
}
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:PullRequestFilesProducer.java
示例9: getFileDetailsShouldFetchCommitsFromGitHub
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Test
public void getFileDetailsShouldFetchCommitsFromGitHub() throws Exception
{
RepositoryId repositoryId = RepositoryId.create(repository.getOrgName(), repository.getSlug());
final Changeset cs = mock(Changeset.class);
when(cs.getNode()).thenReturn("some-hash");
final CommitFile file = new CommitFile()
.setStatus("modified")
.setFilename("my_file")
.setAdditions(1)
.setDeletions(2);
final RepositoryCommit ghCommit = mock(RepositoryCommit.class);
when(ghCommit.getFiles()).thenReturn(ImmutableList.of(file));
when(commitService.getCommit(repositoryId, cs.getNode())).thenReturn(ghCommit);
ChangesetFileDetailsEnvelope changesetFileDetailsEnvelope = communicator.getFileDetails(repository, cs);
List<ChangesetFileDetail> fileDetails = changesetFileDetailsEnvelope.getFileDetails();
assertEquals(fileDetails, ImmutableList.of(
new ChangesetFileDetail(CustomStringUtils.getChangesetFileAction(file.getStatus()), file.getFilename(), file.getAdditions(), file.getDeletions())
));
assertEquals(changesetFileDetailsEnvelope.getCount(), 1);
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:28,代码来源:GithubCommunicatorTest.java
示例10: compare
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Override
public int compare(final CommitFile lhs, final CommitFile rhs) {
String lPath = lhs.getFilename();
final int lSlash = lPath.lastIndexOf('/');
if (lSlash != -1)
lPath = lPath.substring(lSlash + 1);
String rPath = rhs.getFilename();
final int rSlash = rPath.lastIndexOf('/');
if (rSlash != -1)
rPath = rPath.substring(rSlash + 1);
return CASE_INSENSITIVE_ORDER.compare(lPath, rPath);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:15,代码来源:CommitFileComparator.java
示例11: createIntent
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
/**
* Create intent to show file in commit
*
* @param repository
* @param commit
* @param file
* @return intent
*/
public static Intent createIntent(Repository repository, String commit,
CommitFile file) {
Builder builder = new Builder("commit.file.VIEW");
builder.repo(repository);
builder.add(EXTRA_HEAD, commit);
builder.add(EXTRA_PATH, file.getFilename());
builder.add(EXTRA_BASE, file.getSha());
return builder.toIntent();
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:CommitFileViewActivity.java
示例12: addFileStatHeader
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
private void addFileStatHeader(List<CommitFile> files,
LayoutInflater inflater) {
View fileHeader = inflater.inflate(
layout.commit_compare_file_details_header, null);
((TextView) fileHeader.findViewById(id.tv_commit_file_summary))
.setText(CommitUtils.formatStats(files));
adapter.addHeader(fileHeader);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:9,代码来源:CommitCompareListFragment.java
示例13: openLine
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
private void openLine(AdapterView<?> parent, int position) {
Object item = null;
while (--position >= 0) {
item = parent.getItemAtPosition(position);
if (item instanceof CommitFile) {
openFile((CommitFile) item);
return;
}
}
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:11,代码来源:CommitCompareListFragment.java
示例14: onItemClick
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Object item = parent.getItemAtPosition(position);
if (item instanceof RepositoryCommit)
openCommit((RepositoryCommit) item);
else if (item instanceof CommitFile)
openFile((CommitFile) item);
else if (item instanceof CharSequence)
openLine(parent, position);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:12,代码来源:CommitCompareListFragment.java
示例15: FullCommit
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
/**
* Create commit with no comments
*
* @param commit
*/
public FullCommit(final RepositoryCommit commit) {
this.commit = commit;
List<CommitFile> rawFiles = commit.getFiles();
if (rawFiles != null && !rawFiles.isEmpty()) {
files = new ArrayList<FullCommitFile>(rawFiles.size());
for (CommitFile file : rawFiles)
files.add(new FullCommitFile(file));
} else
files = Collections.emptyList();
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:16,代码来源:FullCommit.java
示例16: ComponentConverter
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
public ComponentConverter(String sonarBranch, List<MavenProject> reactorProjects, List<CommitFile> files) {
this.sonarBranch = sonarBranch;
this.reactorProjects = reactorProjects;
for (CommitFile file : files) {
String path = file.getFilename();
if (!path.endsWith( ".java" ))
continue;
String componentKey = toComponentKey( path );
if (componentKey != null)
components.put( componentKey, path );
}
}
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:13,代码来源:ComponentConverter.java
示例17: getFilesSha
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
private Map<String, String> getFilesSha() throws MojoExecutionException {
List<CommitFile> files;
try {
files = pullRequestService.getFiles( repository, pullRequestId );
} catch (IOException e) {
throw new MojoExecutionException( "Unable to retrieve commits from github", e );
}
Map<String, String> shas = Maps.newHashMap();
for (CommitFile commitFile : files) {
shas.put( commitFile.getFilename(),
commitFile.getBlobUrl().replaceAll( ".*blob/", "" ).replaceAll( "/.*", "" ) );
}
return shas;
}
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:16,代码来源:SonarPullRequestMojo.java
示例18: toComponentKeyFlatProject
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
@Test
public void toComponentKeyFlatProject() throws Exception {
List<CommitFile> commits = commits();
List<MavenProject> projects = Lists.newArrayList();
MavenProject root = new MavenProject();
root.setGroupId( "com.mysema.querydsl" );
root.setArtifactId( "querydsl-root" );
root.setFile( new File( "src/test/resources/querydsl/querydsl-root/pom.xml" ).getCanonicalFile() );
projects.add( root );
MavenProject hazelcast = new MavenProject();
hazelcast.setGroupId( "com.mysema.querydsl" );
hazelcast.setArtifactId( "querydsl-hazelcast" );
hazelcast.setFile( new File( "src/test/resources/querydsl/querydsl-hazelcast/pom.xml" ).getCanonicalFile() );
hazelcast.setBuild( new Build() );
hazelcast.getBuild().setSourceDirectory(
new File( "src/test/resources/querydsl/querydsl-hazelcast/src/main/java" ).getCanonicalPath() );
projects.add( hazelcast );
ComponentConverter c = new ComponentConverter( "hazelcast", projects, commits );
assertEquals(
"com.mysema.querydsl:querydsl-hazelcast:hazelcast:com.mysema.query.hazelcast.AbstractIMapQuery",
c.pathToComponent( "/querydsl-hazelcast/src/main/java/com/mysema/query/hazelcast/AbstractIMapQuery.java" ) );
assertEquals(
"com.mysema.querydsl:querydsl-hazelcast:hazelcast:com.mysema.query.hazelcast.impl.HazelcastSerializer",
c.pathToComponent( "/querydsl-hazelcast/src/main/java/com/mysema/query/hazelcast/impl/HazelcastSerializer.java" ) );
assertEquals(
null,
c.pathToComponent( "/querydsl-hazelcast/src/test/java/com/mysema/query/hazelcast/impl/HazelcastSerializerTest.java" ) );
}
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:31,代码来源:ComponentConverterTest.java
示例19: runTest
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
private void runTest(List<MavenProject> projects) {
List<CommitFile> commits = commits();
ComponentConverter c = new ComponentConverter( "hazelcast", projects, commits );
assertEquals(
"com.mysema.querydsl:querydsl-hazelcast:hazelcast:com.mysema.query.hazelcast.AbstractIMapQuery",
c.pathToComponent( "/querydsl-hazelcast/src/main/java/com/mysema/query/hazelcast/AbstractIMapQuery.java" ) );
assertEquals(
"com.mysema.querydsl:querydsl-hazelcast:hazelcast:com.mysema.query.hazelcast.impl.HazelcastSerializer",
c.pathToComponent( "/querydsl-hazelcast/src/main/java/com/mysema/query/hazelcast/impl/HazelcastSerializer.java" ) );
assertEquals(
null,
c.pathToComponent( "/querydsl-hazelcast/src/test/java/com/mysema/query/hazelcast/impl/HazelcastSerializerTest.java" ) );
}
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:14,代码来源:ComponentConverterTest.java
示例20: getFiles
import org.eclipse.egit.github.core.CommitFile; //导入依赖的package包/类
/**
* Get all changed files associated with given pull request id
*
* @param repository
* @param id
* @return list of commit files
* @throws IOException
*/
public List<CommitFile> getFiles(IRepositoryIdProvider repository, int id)
throws IOException {
final String repoId = getId(repository);
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_PULLS);
uri.append('/').append(id);
uri.append(SEGMENT_FILES);
PagedRequest<CommitFile> request = createPagedRequest();
request.setUri(uri);
request.setType(new TypeToken<List<CommitFile>>() {
}.getType());
return getAll(request);
}
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:23,代码来源:PullRequestService.java
注:本文中的org.eclipse.egit.github.core.CommitFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论