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


Java ReceivePack.setPreReceiveHook方法代码示例

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


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

示例1: init

import org.eclipse.jgit.transport.ReceivePack; //导入方法依赖的package包/类
@Override
public void init(Project.NameKey project, ReceivePack rp) {
  ProjectState ps = projectCache.get(project);
  if (!ps.isEnableSignedPush()) {
    rp.setSignedPushConfig(null);
    return;
  } else if (signedPushConfig == null) {
    log.error(
        "receive.enableSignedPush is true for project {} but"
            + " false in gerrit.config, so signed push verification is"
            + " disabled",
        project.get());
    rp.setSignedPushConfig(null);
    return;
  }
  rp.setSignedPushConfig(signedPushConfig);

  List<PreReceiveHook> hooks = new ArrayList<>(3);
  if (ps.isRequireSignedPush()) {
    hooks.add(SignedPushPreReceiveHook.Required.INSTANCE);
  }
  hooks.add(hook);
  hooks.add(rp.getPreReceiveHook());
  rp.setPreReceiveHook(PreReceiveHookChain.newChain(hooks));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:SignedPushModule.java

示例2: create

import org.eclipse.jgit.transport.ReceivePack; //导入方法依赖的package包/类
/**
 * Puts a {@link WriteLatexPutHook} into the returned {@link ReceivePack}.
 *
 * The {@link WriteLatexPutHook} needs our hostname, which we get from the
 * original {@link HttpServletRequest}, used to provide a postback URL to
 * the {@link SnapshotApi}. We also give it the oauth2 that we injected in
 * the {@link Oauth2Filter}, and the {@link Bridge}.
 *
 * At this point, the repository will have been synced to the latest on
 * Overleaf, but it's possible that an update happens on Overleaf while our
 * put hook is running. In this case, we fail, and the user tries again,
 * triggering another sync, and so on.
 * @param httpServletRequest the original request
 * @param repository the JGit {@link Repository} provided by
 * {@link WLRepositoryResolver}
 * @return a correctly hooked {@link ReceivePack}
 */
@Override
public ReceivePack create(
        HttpServletRequest httpServletRequest,
        Repository repository
) {
    Log.info(
            "[{}] Creating receive-pack",
            repository.getWorkTree().getName()
    );
    Optional<Credential> oauth2 = Optional.ofNullable(
            (Credential) httpServletRequest.getAttribute(
                    Oauth2Filter.ATTRIBUTE_KEY));
    ReceivePack receivePack = new ReceivePack(repository);
    String hostname = Util.getPostbackURL();
    if (hostname == null) {
        hostname = httpServletRequest.getLocalName();
    }
    receivePack.setPreReceiveHook(
            new WriteLatexPutHook(repoStore, bridge, hostname, oauth2)
    );
    return receivePack;
}
 
开发者ID:winstonli,项目名称:writelatex-git-bridge,代码行数:40,代码来源:WLReceivePackFactory.java

示例3: create

import org.eclipse.jgit.transport.ReceivePack; //导入方法依赖的package包/类
@Override
public ReceivePack create(HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException {
  ReceivePack receivePack = new ReceivePack(db);

  GwReceiveHook hook = new GwReceiveHook(parsePK(req).get());
  GuiceListener.get().injectMembers(hook);
  receivePack.setPreReceiveHook(hook);
  receivePack.setPostReceiveHook(hook);
  return receivePack;
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:11,代码来源:GitRepositoryServlet.java

示例4: runGitCommand

import org.eclipse.jgit.transport.ReceivePack; //导入方法依赖的package包/类
@Override
protected int runGitCommand() {
	ReceivePack receivePack = new ReceivePack(gitRepository);
	receivePack.setPreReceiveHook(hook);
	receivePack.setPostReceiveHook(hook);
	receivePack.setRefLogIdent(new PersonIdent(username, username + "@"
			+ remoteHost));
	try {
		receivePack.receive(getInputStream(), getOutputStream(),
				getErrorStream());
	} catch (IOException e) {
		return -4;
	}
	return 0;
}
 
开发者ID:litesolutions,项目名称:scm-ssh-plugin,代码行数:16,代码来源:GitCommandFactory.java

示例5: AsyncReceiveCommits

import org.eclipse.jgit.transport.ReceivePack; //导入方法依赖的package包/类
@Inject
AsyncReceiveCommits(
    ReceiveCommits.Factory factory,
    PermissionBackend permissionBackend,
    VisibleRefFilter.Factory refFilterFactory,
    Provider<InternalChangeQuery> queryProvider,
    @ReceiveCommitsExecutor ExecutorService executor,
    RequestScopePropagator scopePropagator,
    ReceiveConfig receiveConfig,
    TransferConfig transferConfig,
    Provider<LazyPostReceiveHookChain> lazyPostReceive,
    ContributorAgreementsChecker contributorAgreements,
    @Named(TIMEOUT_NAME) long timeoutMillis,
    @Assisted ProjectState projectState,
    @Assisted IdentifiedUser user,
    @Assisted Repository repo,
    @Assisted @Nullable MessageSender messageSender,
    @Assisted SetMultimap<ReviewerStateInternal, Account.Id> extraReviewers)
    throws PermissionBackendException {
  this.factory = factory;
  this.executor = executor;
  this.scopePropagator = scopePropagator;
  this.receiveConfig = receiveConfig;
  this.contributorAgreements = contributorAgreements;
  this.timeoutMillis = timeoutMillis;
  this.projectState = projectState;
  this.user = user;
  this.repo = repo;
  this.messageSender = messageSender;
  this.extraReviewers = extraReviewers;

  Project.NameKey projectName = projectState.getNameKey();
  rp = new ReceivePack(repo);
  rp.setAllowCreates(true);
  rp.setAllowDeletes(true);
  rp.setAllowNonFastForwards(true);
  rp.setRefLogIdent(user.newRefLogIdent());
  rp.setTimeout(transferConfig.getTimeout());
  rp.setMaxObjectSizeLimit(transferConfig.getEffectiveMaxObjectSizeLimit(projectState));
  rp.setCheckReceivedObjects(projectState.getConfig().getCheckReceivedObjects());
  rp.setRefFilter(new ReceiveRefFilter());
  rp.setAllowPushOptions(true);
  rp.setPreReceiveHook(this);
  rp.setPostReceiveHook(lazyPostReceive.get());

  // If the user lacks READ permission, some references may be filtered and hidden from view.
  // Check objects mentioned inside the incoming pack file are reachable from visible refs.
  this.perm = permissionBackend.user(user).project(projectName);
  try {
    this.perm.check(ProjectPermission.READ);
  } catch (AuthException e) {
    rp.setCheckReferencedObjectsAreReachable(receiveConfig.checkReferencedObjectsAreReachable);
  }

  List<AdvertiseRefsHook> advHooks = new ArrayList<>(4);
  allRefsWatcher = new AllRefsWatcher();
  advHooks.add(allRefsWatcher);
  advHooks.add(refFilterFactory.create(projectState, repo).setShowMetadata(false));
  advHooks.add(new ReceiveCommitsAdvertiseRefsHook(queryProvider, projectName));
  advHooks.add(new HackPushNegotiateHook());
  rp.setAdvertiseRefsHook(AdvertiseRefsHookChain.newChain(advHooks));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:63,代码来源:AsyncReceiveCommits.java


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