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


Java AddCommand.addFilepattern方法代码示例

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


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

示例1: makeVersion

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
@Override
public VersionInfo makeVersion(FileVersion... fileVersions) throws IOException {
  persistence.makeVersion(fileVersions);
  Repository repository = getRepository(fileVersions[0].getFile());
  Git git = new Git(repository);
  try {
    AddCommand adder = git.add();
    for (FileVersion fileVersion : fileVersions) {
      adder.addFilepattern(getPath(fileVersion.getFile(), repository));
    }
    adder.call();
    commit(git, String.format("[FitNesse] Updated files: %s.", formatFileVersions(fileVersions)), fileVersions[0].getAuthor());
  } catch (GitAPIException e) {
    throw new IOException("Unable to commit changes", e);
  }
  return VersionInfo.makeVersionInfo(fileVersions[0].getAuthor(), fileVersions[0].getLastModificationTime());
}
 
开发者ID:fitnesse,项目名称:fitnesse-git-plugin,代码行数:18,代码来源:GitFileVersionsController.java

示例2: commit

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
public void commit(File repo, List<String> fileUpdates) {
    if (fileUpdates.isEmpty()) {
        return;
    }

    try {
        Git gitHandle = Git.open(repo);
        AddCommand addCommand = gitHandle.add();
        for (String fileUpdate : fileUpdates) {
            addCommand = addCommand.addFilepattern(fileUpdate);
            LOG.info("git add'ing {}", fileUpdate);

        }
        DirCache addResult = addCommand.call();
        RevCommit commitResult = gitHandle.commit().setCommitter("dev search agent", "[email protected]").setMessage("Automated change performed by dev-search-agent").call();

        LOG.info("git commit'd: {}", commitResult.toString());
    } catch (GitAPIException | IOException e) {
        throw new RuntimeException("Problem pushing " + repo.getPath(), e);
    }
}
 
开发者ID:raymyers,项目名称:dev-search,代码行数:22,代码来源:GitService.java

示例3: createGitRepoWithPom

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
public static String createGitRepoWithPom(final File path, final InputStream pom, final File... files) throws Exception {
    File repo = new File(path, "repo");
    if(repo.exists() == false) {
        Files.createDirectory(repo.toPath());
    }
    Git git = Git.init().setDirectory(repo).call();
    String gitUrl = "file://" + repo.getAbsolutePath();

    FileUtils.copyInputStreamToFile(pom, new File(repo, "pom.xml"));
    AddCommand add = git.add();
    add.addFilepattern("pom.xml");
    for (File f : files) {
        add.addFilepattern(f.getName());
    }
    add.call();
    CommitCommand commit = git.commit();
    commit.setMessage("initial commit").call();
    return gitUrl;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:MavenTestUtils.java

示例4: addAll

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
 * Adds multiple files to the staging area. Preparing the for commit
 * 
 * @param fileNames
 *          - the names of the files to be added
 */
public void addAll(List<FileStatus> files) {

	try {
	  
	  RmCommand removeCmd = null;
	  AddCommand addCmd = null;
	  
		for (FileStatus file : files) {
			if (file.getChangeType() == GitChangeType.MISSING) {
			  if (removeCmd == null) {
			    removeCmd = git.rm();
			  }
         removeCmd.addFilepattern(file.getFileLocation());
			} else {
			  if (addCmd == null) {
			    addCmd = git.add();
			  }
         addCmd.addFilepattern(file.getFileLocation());
			}
		}
		
		if (removeCmd != null) {
		  removeCmd.call();
		}
		
		if (addCmd != null) {
		  addCmd.call();
		}
		
		fireFileStateChanged(new ChangeEvent(GitCommand.STAGE, getPaths(files)));
	} catch (GitAPIException e) {
		if (logger.isDebugEnabled()) {
			logger.debug(e, e);
		}
	}
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:43,代码来源:GitAccess.java

示例5: add

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
@Override
public void add(String itemToAdd) {
    
    AddCommand command = _git.add();
    command.addFilepattern(itemToAdd);
    try {
        command.call();
    } catch (Throwable e) {
        throw new RuntimeException(String.format("Failed to add  [%s]", itemToAdd), e);
    }
    
}
 
开发者ID:Verigreen,项目名称:verigreen,代码行数:13,代码来源:JGitOperator.java

示例6: addFiles

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
 * @see gov.va.isaac.interfaces.sync.ProfileSyncI#addFiles(java.io.File, java.util.Set)
 */
@Override
public void addFiles(String... files) throws IllegalArgumentException, IOException
{
	try
	{
		log.info("Add Files called {}", Arrays.toString(files));
		Git git = getGit();
		if (files.length == 0)
		{
			log.debug("No files to add");
		}
		else
		{
			AddCommand ac = git.add();
			for (String file : files)
			{
				ac.addFilepattern(file);
			}
			ac.call();
		}
		log.info("addFiles Complete.  Current status: " + statusToString(git.status().call()));
	}
	catch (GitAPIException e)
	{
		log.error("Unexpected", e);
		throw new IOException("Internal error", e);
	}
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:32,代码来源:SyncServiceGIT.java

示例7: commitAndPush

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
 * Adds all the files of the specified directory in the local git repository
 * (git add .), then commits the changes (git commit .), and finally pushes
 * the changes on the remote repository (git push)
 *
 * @param directory the directory in which the local git repository is located
 * @param username  the username to be used while pushing
 * @param password  the password matching with the provided username to be used
 *                  for authentication
 * @param message   the commit message to be used
 * @throws GitAPIException if something's going wrong while interacting with Git
 * @throws IOException     if something's going wrong while manipulating the local
 *                         repository
 */
public static void commitAndPush(@NonNull File directory, String username,
                                 String password, String message) throws GitAPIException,
        IOException {
    try {
        final Git git = Git.open(directory);
        // run the add
        final AddCommand addCommand = git.add();
        for (final String filePath : directory.list())
            if (!".git".equals(filePath))
                addCommand.addFilepattern(filePath);
        addCommand.call();
        log.info("Added content of the directory" + directory
                + " in the Git repository located in "
                + directory.toString());
        // and then commit
        final PersonIdent author = new PersonIdent(username, "");
        git.commit().setCommitter(author).setMessage(message)
                .setAuthor(author).call();
        log.info("Commited the changes in the Git repository...");
        // and finally push
        final UsernamePasswordCredentialsProvider userCredential = new UsernamePasswordCredentialsProvider(
                username, password);
        git.push().setCredentialsProvider(userCredential).call();
        log.info("Pushed the changes in remote Git repository...");
    } catch (final GitAPIException e) {
        log.error(e.getMessage(), e);
        throw e;
    }
}
 
开发者ID:awltech,项目名称:easycukes,代码行数:44,代码来源:GitHelper.java

示例8: call

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException,
    NoFilepatternException, GitAPIException {

  AddCommand ac = git.add();

  if (!Const.isEmpty(this.filepattern)) {
    ac = ac.addFilepattern(gitOperationsStep
        .environmentSubstitute(this.filepattern));
  }

  ac.setUpdate(update).call();
  return git;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:16,代码来源:AddGitCommand.java


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