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


Java FileRepositoryBuilder.create方法代码示例

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


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

示例1: getRepo

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
/**
 *
 * @param repoPath
 * @return
 * @throws IOException
 */
public static Repository getRepo(String repoPath) throws IOException {
    Repository repo;
    File repoFile = new File(repoPath);
    if (repoFile.exists()) {
        // Open an existing repository
        repo = new FileRepositoryBuilder()
                .setGitDir(new File(repoPath))
                .build();
    } else {
        // Create a new repository
        repo = FileRepositoryBuilder.create(
                new File(repoPath));
        repo.create(true);
    }
    System.out.println(repo.getDirectory());
    return repo;
}
 
开发者ID:alexmy21,项目名称:gmds,代码行数:24,代码来源:Commands.java

示例2: onCreateView

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    try {
        Repository repository = FileRepositoryBuilder.create(gitDirFrom(getArguments()));
        RevCommit before = commitFrom(repository, getArguments(), BEFORE_REV), after = commitFrom(repository, getArguments(), AFTER_REV);
        Log.d(TAG, "onCreateView before = " + before);
        Log.d(TAG, "onCreateView after  = " + after);

        View v = inflater.inflate(R.layout.rev_commit_view, container, false);
        DiffSliderView diffSlider = (DiffSliderView) v.findViewById(R.id.RevCommitDiffSlider);
        ExpandableListView expandableList = (ExpandableListView) v.findViewById(android.R.id.list);
        expandableList.setAdapter(new CommitChangeListAdapter(repository, after, before, diffSlider,
                expandableList, getActivity()));
        return v;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:19,代码来源:CommitDiffFragment.java

示例3: setup

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
@Before
public void setup() throws IOException {
    // Define a Test Directory
    File localPath = File.createTempFile("TestGitRepository", "");

    // prepare a new folder
    if(localPath.exists()) localPath.delete();

    // create the repository
    repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
    repository.create();

    // Setup Mocks
    when(build.getWorkspace()).thenReturn(new FilePath(new File(getClass().getResource("/").getPath())));
    when(listener.getLogger()).thenReturn(System.out);

    when(app.getName()).thenReturn("testapp");
    when(app.getGitUrl()).thenReturn(repository.getDirectory().getAbsolutePath());
    
    mockStatic(Computer.class);
    PowerMockito.when(Computer.currentComputer()).thenReturn(mock(MasterComputer.class));
    
}
 
开发者ID:jenkinsci,项目名称:openshift-deployer-plugin,代码行数:24,代码来源:DeploymentPackageTest.java

示例4: createNewRepository

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
private static Repository createNewRepository() throws IOException {
    // prepare a new folder
    File localPath = File.createTempFile("TestGitRepository", "");
    if(!localPath.delete()) {
        throw new IOException("Could not delete temporary file " + localPath);
    }

    if(!localPath.mkdirs()) {
        throw new IOException("Could not create directory " + localPath);
    }

    // create the directory
    Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
    repository.create();

    return repository;
}
 
开发者ID:centic9,项目名称:jgit-cookbook,代码行数:18,代码来源:Main.java

示例5: createRepository

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
private static File createRepository() throws IOException, GitAPIException {
    File dir = File.createTempFile("gitinit", ".test");
    if(!dir.delete()) {
        throw new IOException("Could not delete temporary file " + dir);
    }

    Git.init()
            .setDirectory(dir)
            .call();

    try (Repository repository = FileRepositoryBuilder.create(new File(dir.getAbsolutePath(), ".git"))) {
        System.out.println("Created a new repository at " + repository.getDirectory());
    }

    return dir;
}
 
开发者ID:centic9,项目名称:jgit-cookbook,代码行数:17,代码来源:TestSubmodules.java

示例6: main

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, GitAPIException {
    // run the init-call
    File dir = File.createTempFile("gitinit", ".test");
    if(!dir.delete()) {
        throw new IOException("Could not delete file " + dir);
    }

    // The Git-object has a static method to initialize a new repository
    try (Git git = Git.init()
            .setDirectory(dir)
            .call()) {
        System.out.println("Created a new repository at " + git.getRepository().getDirectory());
    }

    dir = File.createTempFile("repoinit", ".test");
    if(!dir.delete()) {
        throw new IOException("Could not delete file " + dir);
    }

    // you can also create a Repository-object directly from the
    try (Repository repository = FileRepositoryBuilder.create(new File(dir.getAbsolutePath(), ".git"))) {
        System.out.println("Created a new repository at " + repository.getDirectory());
    }
}
 
开发者ID:centic9,项目名称:jgit-cookbook,代码行数:25,代码来源:InitRepository.java

示例7: ScenarioBuilder

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
/**
 * Creates a ScenarioBuilder object pointing to a temporary fresh new & empty git repository. 
 */
public ScenarioBuilder() {
    try {
        this.scenario = new Scenario(new File(Files.createTempDir(), ".git"));
        this.repository = FileRepositoryBuilder.create(scenario.getRepositoryLocation());
        repository.create();
        this.git = new Git(repository);
    } catch (Exception ex) {
        throw new IllegalStateException("failure building scenario", ex);
    }
}
 
开发者ID:jgitver,项目名称:jgitver,代码行数:14,代码来源:Scenarios.java

示例8: createRepository

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
public static Repository createRepository(File repo) throws IOException, GitAPIException {
    if (!repo.exists()) {
        Files.createDirectory(repo.toPath());
    }

    Repository repository = FileRepositoryBuilder.create(new File(repo, ".git"));
    repository.create();

    return repository;
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:11,代码来源:RepositoryHelper.java

示例9: createGitRepo

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
public static Git createGitRepo(File dir) throws Exception {
  Repository repo = FileRepositoryBuilder.create(dir);
  repo.create(false);

  Git git = new Git(repo);
  
  // Commit first revision
  git.commit().setMessage("Repository created").call();
  
  return git;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:12,代码来源:AbstractWsPrjInit.java

示例10: testCreate

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
/**
* �����½��ֿ�
*/
@Test
public void testCreate() throws IOException {
    //�����½��ֿ��ַ
    Repository newRepo = FileRepositoryBuilder.create(new File(initPath + "/.git"));
    newRepo.create();
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:10,代码来源:test.java

示例11: before

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
@Before
public void before() throws IOException, GitAPIException {
  worktree = temp.newFolder().toPath();
  Repository repo = FileRepositoryBuilder.create(worktree.resolve(".git").toFile());
  repo.create();

  git = new Git(repo);

  createAndCommitFile(worktree, "file-in-first-commit.xoo");
}
 
开发者ID:SonarSource,项目名称:sonar-scm-git,代码行数:11,代码来源:GitScmProviderTest.java

示例12: gitPull

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
public static void gitPull(String localPathDynamic) {
	Repository localRepo;
	try {
		localRepo = FileRepositoryBuilder.create(new File(localPathDynamic + File.separator + ".git"));
		git = new Git(localRepo);
		PullCommand pullCmd = git.pull();
		pullCmd.call();
	} catch (IOException | GitAPIException e) {
		log.error("Error in pulling content from the git repository, hence proceeding with the previously cloned content ," + e);
	} 

}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:13,代码来源:JGitSampleRepoManager.java

示例13: onCreateLoader

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
@Override
public Loader<BlobView> onCreateLoader(int id, Bundle b) {
    return new AsyncLoader<BlobView>(getActivity()) {
        public BlobView loadInBackground() {
            Bundle args = getArguments();
            try {
                Repository repo = FileRepositoryBuilder.create(gitDirFrom(args));
                ObjectId revision = repo.resolve(args.getString(UNTIL_REVS));
                RevWalk revWalk = new RevWalk(repo);
                RevCommit commit = revWalk.parseCommit(revision);
                TreeWalk treeWalk = TreeWalk.forPath(repo, args.getString(PATH), commit.getTree());
                ObjectId blobId = treeWalk.getObjectId(0);

                ObjectLoader objectLoader = revWalk.getObjectReader().open(blobId, Constants.OBJ_BLOB);
                ObjectStream binaryTestStream = objectLoader.openStream();
                boolean blobIsBinary = RawText.isBinary(binaryTestStream);
                binaryTestStream.close();
                Log.d(TAG, "blobIsBinary="+blobIsBinary);
                return blobIsBinary?new BinaryBlobView(objectLoader, treeWalk.getNameString()):new TextBlobView(objectLoader);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }


    };
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:28,代码来源:BlobViewFragment.java

示例14: onCreateView

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    try {
        Repository repository = FileRepositoryBuilder.create(gitDirFrom(getArguments()));
        ObjectId commitId = revisionIdFrom(repository, getArguments(), REVISION);
        Log.d(TAG, "onCreateView with "+commitId);

        View v=inflater.inflate(R.layout.commit_detail_view, container, false);

        CommitNavigationView commitNavigationView = (CommitNavigationView) v.findViewById(R.id.commit_navigation);

        commitNavigationView.setCommitSelectedListener(commitSelectedListener);
        PlotCommit<PlotLane> commit = commitSelectedListener.plotCommitFor(commitId);

        commitNavigationView.setCommit(commit);

        ((ObjectIdView) v.findViewById(R.id.commit_id)).setObjectId(commit);

        ViewGroup vg = (ViewGroup) v.findViewById(R.id.commit_people_group);

        PersonIdent author = commit.getAuthorIdent(), committer = commit.getCommitterIdent();
        if (author.equals(committer)) {
            addPerson("Author & Committer", author, vg);
        } else {
            addPerson("Author", author, vg);
            addPerson("Committer", committer, vg);
        }
        TextView textView = (TextView) v.findViewById(R.id.commit_message_text);
        textView.setText(commit.getFullMessage());
        return v;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:36,代码来源:CommitDetailsFragment.java

示例15: apply

import org.eclipse.jgit.storage.file.FileRepositoryBuilder; //导入方法依赖的package包/类
public RepoSummary apply(File gitdir) {
    try {
        Repository repo = FileRepositoryBuilder.create(gitdir);

        return new RepoSummary(repo);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:11,代码来源:RepoSummary.java


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