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


Java FetchResult.getTrackingRefUpdates方法代码示例

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


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

示例1: fetch

import org.eclipse.jgit.transport.FetchResult; //导入方法依赖的package包/类
private List<TrackingRefUpdate> fetch(Repository repository) throws Exception {
       logger.info("Fetching changes of repository {}", repository.getDirectory().toString());
       try (Git git = new Git(repository)) {
   		FetchResult result = git.fetch().call();
   		
   		Collection<TrackingRefUpdate> updates = result.getTrackingRefUpdates();
   		List<TrackingRefUpdate> remoteRefsChanges = new ArrayList<TrackingRefUpdate>();
   		for (TrackingRefUpdate update : updates) {
   			String refName = update.getLocalName();
   			if (refName.startsWith(REMOTE_REFS_PREFIX)) {
   				ObjectId newObjectId = update.getNewObjectId();
   				logger.info("{} is now at {}", refName, newObjectId.getName());
   				remoteRefsChanges.add(update);
   			}
   		}
   		if (updates.isEmpty()) {
   			logger.info("Nothing changed");
   		}
   		return remoteRefsChanges;
       }
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:22,代码来源:GitServiceImpl.java

示例2: fetch

import org.eclipse.jgit.transport.FetchResult; //导入方法依赖的package包/类
private List<TrackingRefUpdate> fetch(Repository repository) throws Exception {
	try (Git git = new Git(repository)) {
		FetchResult result = git.fetch().call();
		
		Collection<TrackingRefUpdate> updates = result.getTrackingRefUpdates();
		List<TrackingRefUpdate> remoteRefsChanges = new ArrayList<TrackingRefUpdate>();
		for (TrackingRefUpdate update : updates) {
			String refName = update.getLocalName();
			if (refName.startsWith(REMOTE_REFS_PREFIX)) {
				remoteRefsChanges.add(update);
			}
		}
		return remoteRefsChanges;
	}
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:16,代码来源:GitHelper.java

示例3: fetch

import org.eclipse.jgit.transport.FetchResult; //导入方法依赖的package包/类
public FetchResult fetch(String remote, Collection<RefSpec> toFetch) {
    Log.d(TAG, "About to run fetch : " + remote);

    for (Map.Entry<String,Ref> entry : git.getRepository().getAllRefs().entrySet()) {
        Log.d(TAG, entry.getKey()+" = "+entry.getValue());
    }
    FetchResult fetchResult = null;
    try {
        fetchResult = git.fetch()
                .setRemote(remote)
                .setRefSpecs(toFetch == null ? Collections.<RefSpec>emptyList() : newArrayList(toFetch))
                .setProgressMonitor(messagingProgressMonitor)
                .setTransportConfigCallback(transportConfigCallback)
                .setCredentialsProvider(credentialsProvider)
                .call();
    } catch (GitAPIException e) {
        throw exceptionWithFriendlyMessageFor(e);
    }
    Log.d(TAG, "Fetch complete with : " + fetchResult+" messages="+fetchResult.getMessages());
    for (Ref ref : fetchResult.getAdvertisedRefs()) {
        Log.d(TAG, "AdvertisedRef : " + ref.getName()+" objectId="+ref.getObjectId());
    }
    for (TrackingRefUpdate update : fetchResult.getTrackingRefUpdates()) {
        Log.d(TAG, "TrackingRefUpdate : " + update.getLocalName() + " old=" + update.getOldObjectId() + " new=" + update.getNewObjectId());
    }
    repoUpdateBroadcaster.broadcastUpdate();
    return fetchResult;
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:29,代码来源:GitFetchService.java


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