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


Java WrongRepositoryStateException类代码示例

本文整理汇总了Java中org.eclipse.jgit.api.errors.WrongRepositoryStateException的典型用法代码示例。如果您正苦于以下问题:Java WrongRepositoryStateException类的具体用法?Java WrongRepositoryStateException怎么用?Java WrongRepositoryStateException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WrongRepositoryStateException类属于org.eclipse.jgit.api.errors包,在下文中一共展示了WrongRepositoryStateException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
private static void visit( File directory ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    for ( final File child : directory.listFiles() ) {
        if ( child.isDirectory() ) {
            visit( child );
        }
        final String name = child.getName();
        if ( name.equals( ".git" ) ) {

            Thread t = new Thread( new Runnable() {
                public void run() {
                    try {
                        Git git = Git.open( child.getParentFile() );
                        PullResult pullResult = git.pull().call();
                        System.out.println( "pulled on " + child.getParentFile().getName() + ", pullResult = " + pullResult.isSuccessful() + ", " + pullResult.getFetchedFrom() + ", fetch messages: " + pullResult.getFetchResult().getMessages() );
                    }
                    catch ( Exception e ) {
                        e.printStackTrace();
                    }
                }
            } );
            t.start();

        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:PullAll.java

示例2: doHandle

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
private OneShotEvent doHandle(MergeRequestHookTriggerHandler mergeRequestHookTriggerHandler,
		MergeRequestObjectAttributesBuilder objectAttributes) throws GitAPIException, IOException, NoHeadException,
		NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException,
		AmbiguousObjectException, IncorrectObjectTypeException, MissingObjectException, InterruptedException {
	Git.init().setDirectory(tmp.getRoot()).call();
       tmp.newFile("test");
       Git git = Git.open(tmp.getRoot());
       git.add().addFilepattern("test");
       RevCommit commit = git.commit().setMessage("test").call();
       ObjectId head = git.getRepository().resolve(Constants.HEAD);
       String repositoryUrl = tmp.getRoot().toURI().toString();

       final OneShotEvent buildTriggered = new OneShotEvent();
       FreeStyleProject project = jenkins.createFreeStyleProject();
       project.setScm(new GitSCM(repositoryUrl));
       project.getBuildersList().add(new TestBuilder() {
           @Override
           public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
               buildTriggered.signal();
               return true;
           }
       });
       project.setQuietPeriod(0);
	mergeRequestHookTriggerHandler.handle(project, mergeRequestHook()
               .withObjectAttributes(objectAttributes
           		    .withTargetBranch("refs/heads/" + git.nameRev().add(head).call().get(head))
           		    .withLastCommit(commit().withAuthor(user().withName("test").build()).withId(commit.getName()).build())
                   .build())
               .withProject(project()
                   .withWebUrl("https://gitlab.org/test.git")
                   .build()
               )
               .build(), true, BranchFilterFactory.newBranchFilter(branchFilterConfig().build(BranchFilterType.All)),
           newMergeRequestLabelFilter(null));

       buildTriggered.block(10000);
       return buildTriggered;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:39,代码来源:MergeRequestHookTriggerHandlerImplTest.java

示例3: call

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException,
    WrongRepositoryStateException, InvalidConfigurationException,
    DetachedHeadException, InvalidRemoteException, CanceledException,
    RefNotFoundException, NoHeadException, TransportException,
    GitAPIException {
  git.pull().setCredentialsProvider(cp).setRebase(rebase).call();
  return git;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:11,代码来源:PullGitCommand.java

示例4: call

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException, NoHeadException,
    NoMessageException, UnmergedPathsException,
    ConcurrentRefUpdateException, WrongRepositoryStateException,
    GitAPIException {
  CommitCommand cc = git
      .commit()
      .setAuthor(
          gitOperationsStep
              .environmentSubstitute(this.authorName == null ? ""
                  : this.authorName),
          gitOperationsStep
              .environmentSubstitute(this.authorEmail == null ? ""
                  : this.authorEmail))
      .setCommitter(
          gitOperationsStep
              .environmentSubstitute(this.committerName == null ? ""
                  : this.committerName),
          gitOperationsStep
              .environmentSubstitute(this.committerEmail == null ? ""
                  : this.committerName));

  if (!Const.isEmpty(this.commitMessage)) {
    cc = cc.setMessage(gitOperationsStep
        .environmentSubstitute(this.commitMessage));
  }
  cc.setAll(all).setInsertChangeId(insertChangeId).setAmend(amend).call();
  return git;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:31,代码来源:CommitGitCommand.java

示例5: copyDefaultTemplate

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
private Git copyDefaultTemplate(File tmpDir) throws URISyntaxException, IOException, NoFilepatternException,
		NoHeadException, NoMessageException, UnmergedPathException, ConcurrentRefUpdateException,
		WrongRepositoryStateException {
	Git git;

	copySkeleton(tmpDir);

	git = Git.init().setDirectory(tmpDir).call();
	git.add().addFilepattern(".").call();
	git.commit().setCommitter("DevHub", "[email protected]").setMessage("Initial commit").call();
	log.debug("Initialized git repo with default template");
	return git;
}
 
开发者ID:devhub-tud,项目名称:devhub-prototype,代码行数:14,代码来源:GitRepositoryUtils.java

示例6: createVersionFactory

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
@Before
public void createVersionFactory() throws IOException, NoHeadException,
        NoMessageException, UnmergedPathsException,
        ConcurrentRefUpdateException, WrongRepositoryStateException,
        GitAPIException {
    repo = createRepository();
    git = initializeGitFlow(repo);
    versionFactory = new TagBasedVersionFactory();
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:10,代码来源:TagBasedVersionFactoryTest.java

示例7: testCommitCount

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
@Test
public void testCommitCount() throws NoHeadException, NoMessageException,
        UnmergedPathsException, ConcurrentRefUpdateException,
        WrongRepositoryStateException, GitAPIException,
        NoWorkTreeException, IOException {
    tag("v0.1.1-rc");
    makeCommit();
    makeCommit();
    RevCommit head = makeCommit();
    validateUnstable("0.1.1-rc", 3, head, Dirty.NO, DOT);
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:12,代码来源:TagBasedVersionFactoryTest.java

示例8: commit

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
public static void commit(Repo repo, boolean stageAll, boolean isAmend,
        String msg, String authorName, String authorEmail) throws Exception, NoHeadException, NoMessageException,
        UnmergedPathsException, ConcurrentRefUpdateException,
        WrongRepositoryStateException, GitAPIException, StopTaskException {
    Context context = SGitApplication.getContext();
    StoredConfig config = repo.getGit().getRepository().getConfig();
    String committerEmail = config.getString("user", null, "email");
    String committerName = config.getString("user", null, "name");

    if (committerName == null || committerName.equals("")) {
        committerName = Profile.getUsername(context);
    }
    if (committerEmail == null || committerEmail.equals("")) {
        committerEmail = Profile.getEmail(context);
    }
    if (committerName.isEmpty() || committerEmail.isEmpty()) {
        throw new Exception("Please set your name and email");
    }
    if (msg.isEmpty()) {
        throw new Exception("Please include a commit message");
    }
    CommitCommand cc = repo.getGit().commit()
            .setCommitter(committerName, committerEmail).setAll(stageAll)
            .setAmend(isAmend).setMessage(msg);
    if (authorName != null && authorEmail != null) {
        cc.setAuthor(authorName, authorEmail);
    }
    cc.call();
    repo.updateLatestCommitInfo();
}
 
开发者ID:sheimi,项目名称:SGit,代码行数:31,代码来源:CommitChangesTask.java

示例9: directWorkflowURL

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
/**
 * Displaying workflows
 */
@Test
public void directWorkflowURL() throws Exception {

    Workflow mockWorkflow = Mockito.mock(Workflow.class);
    QueuedWorkflow mockQueuedWorkflow = Mockito.mock(QueuedWorkflow.class);
    when(mockQueuedWorkflow.getWorkflowList()).thenReturn(null);

    // Mock service
    WorkflowService mockWorkflowService = Mockito.mock(WorkflowService.class);
    when(mockWorkflowService.getWorkflow(Matchers.<GitDetails>anyObject()))
            .thenReturn(mockWorkflow)
            .thenReturn(null);
    when(mockWorkflowService.createQueuedWorkflow(anyObject()))
            .thenReturn(mockQueuedWorkflow)
            .thenThrow(new WorkflowNotFoundException())
            .thenThrow(new WrongRepositoryStateException("Some Error"))
            .thenThrow(new TransportException("No SSH Key"))
            .thenThrow(new IOException());
    List<WorkflowOverview> listOfTwoOverviews = new ArrayList<>();
    listOfTwoOverviews.add(new WorkflowOverview("/workflow1.cwl", "label", "doc"));
    listOfTwoOverviews.add(new WorkflowOverview("/workflow2.cwl", "label2", "doc2"));
    when(mockWorkflowService.getWorkflowsFromDirectory(anyObject()))
            .thenReturn(listOfTwoOverviews)
            .thenReturn(Collections.singletonList(new WorkflowOverview("/workflow1.cwl", "label", "doc")));

    // Mock controller/MVC
    WorkflowController workflowController = new WorkflowController(
            Mockito.mock(WorkflowFormValidator.class),
            mockWorkflowService,
            Mockito.mock(GraphVizService.class));
    MockMvc mockMvc = MockMvcBuilders
            .standaloneSetup(workflowController)
            .build();

    // Workflow already exists in the database
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/workflow.cwl"))
            .andExpect(status().isOk())
            .andExpect(view().name("workflow"))
            .andExpect(model().attribute("workflow", is(mockWorkflow)));

    // Workflow needs to be created, loading page
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/workflow.cwl"))
            .andExpect(status().isOk())
            .andExpect(view().name("loading"))
            .andExpect(model().attribute("queued", is(mockQueuedWorkflow)));

    // Directory URL, select between
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within"))
            .andExpect(status().isOk())
            .andExpect(view().name("selectworkflow"))
            .andExpect(model().attributeExists("gitDetails"))
            .andExpect(model().attributeExists("workflowOverviews"));

    // Directory URL with only one workflow redirects
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within"))
            .andExpect(status().isFound())
            .andExpect(redirectedUrl("/workflows/github.com/owner/reponame/blob/branch/path/within/workflow1.cwl"));

    // Workflow not found
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/nonexistant.cwl"))
            .andExpect(status().isFound())
            .andExpect(MockMvcResultMatchers.flash().attributeExists("errors"));

    // Git API error
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/cantbecloned.cwl"))
            .andExpect(status().isFound())
            .andExpect(MockMvcResultMatchers.flash().attributeExists("errors"));

    // Submodules with SSH Url
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/submodulewithssh.cwl"))
            .andExpect(status().isFound())
            .andExpect(MockMvcResultMatchers.flash().attributeExists("errors"));

    // Unexpected error
    mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within/badworkflow.cwl"))
            .andExpect(status().isFound())
            .andExpect(MockMvcResultMatchers.flash().attributeExists("errors"));
}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:82,代码来源:WorkflowControllerTest.java

示例10: main

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
public static void main( String[] args ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    visit( new File( "C:\\workingcopy\\phet-little-gits" ) );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:PullAll.java

示例11: makeCommit

import org.eclipse.jgit.api.errors.WrongRepositoryStateException; //导入依赖的package包/类
private RevCommit makeCommit() throws NoHeadException, NoMessageException,
        UnmergedPathsException, ConcurrentRefUpdateException,
        WrongRepositoryStateException, GitAPIException {
    return git.commit().setCommitter(COMMITTER).setMessage("some commit").call();
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:6,代码来源:TagBasedVersionFactoryTest.java


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