Пример #1
0
 /**
  * Creates new PersonIdent from config info in repository, with current time. This new PersonIdent
  * gets the info from the default committer as available from the configuration.
  *
  * @param repo
  */
 public PersonIdent(final Repository repo) {
   final UserConfig config = repo.getConfig().get(UserConfig.KEY);
   name = config.getCommitterName();
   emailAddress = config.getCommitterEmail();
   when = SystemReader.getInstance().getCurrentTime();
   tzOffset = SystemReader.getInstance().getTimezone(when);
 }
Пример #2
0
 private static RevCommit commit(
     IProject project, String commitMessage, Repository repository, IProgressMonitor monitor)
     throws CoreException {
   Assert.isLegal(project != null, "Could not commit project. No project provided");
   Assert.isLegal(
       repository != null,
       MessageFormat.format(
           "Could not commit. Project \"{0}\" is not connected to a repository (call #connect(project, repository) first)",
           project.getName()));
   /** TODO: add capability to commit selectively */
   UserConfig userConfig = getUserConfig(repository);
   CommitOperation op =
       new CommitOperation(
           null,
           null,
           null,
           getFormattedUser(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
           getFormattedUser(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
           commitMessage);
   op.setCommitAll(true);
   op.setRepository(repository);
   op.execute(monitor);
   return op.getCommit();
 }