本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}