private Set<String> changesBetweenBranchs(String origine, String destination, Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException { ChangeLogScmRequest scmRequest = new ChangeLogScmRequest(repository, new ScmFileSet(scmRoot)); scmRequest.setScmBranch(new ScmBranch(destination + ".." + origine)); return pathsAffectedByChange(scmRequest, statusToInclude, NO_LIMIT); }
private Set<String> localChanges(Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException { final StatusScmResult status = this.manager.status(repository, new ScmFileSet(scmRoot)); Set<String> affected = new LinkedHashSet<>(); for (final ScmFile file : status.getChangedFiles()) { if (statusToInclude.contains(file.getStatus())) { affected.add(file.getPath()); } } return affected; }
private Set<String> lastCommitChanges(Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException { ChangeLogScmRequest scmRequest = new ChangeLogScmRequest(repository, new ScmFileSet(scmRoot)); scmRequest.setLimit(1); return pathsAffectedByChange(scmRequest, statusToInclude, 1); }
private Set<String> pathsAffectedByChange(ChangeLogScmRequest scmRequest, Set<ScmFileStatus> statusToInclude, int limit) throws ScmException { Set<String> affected = new LinkedHashSet<>(); ChangeLogScmResult changeLogScmResult = this.manager.changeLog(scmRequest); if (changeLogScmResult.isSuccess()) { List<ChangeSet> changeSets = limit(changeLogScmResult.getChangeLog().getChangeSets(),limit); for (ChangeSet change : changeSets) { List<ChangeFile> files = change.getFiles(); for (final ChangeFile changeFile : files) { if (statusToInclude.contains(changeFile.getAction())) { affected.add(changeFile.getName()); } } } } return affected; }
/** * Check that the ScmResult was a successful operation * * @param result the SCM result. * * @throws ScmException */ private void checkScmResult(ScmResult result) throws ScmException { if (!result.isSuccess()) { throw new ScmException("Unable to commit file. " + result.getProviderMessage() + " " + (result.getCommandOutput() == null ? "" : result.getCommandOutput())); } }
protected ScmFileSet getScmFileSet() { return new ScmFileSet( getWorkingCopy() ); }
public ScmTagParameters getScmTagParameters( CommandParameter parameter ) throws ScmException { return (ScmTagParameters) getObject( ScmTagParameters.class, parameter, new ScmTagParameters() ); }
protected void assertResultIsSuccess( ScmResult result ) { if ( result.isSuccess() ) { return; } printOutputError( result ); fail( "The command result success flag was false." ); }
/** * @param datePattern the date pattern used in changelog output returned by scm tool */ public void setDatePattern( String datePattern ) throws ScmException { parameters.setString( CommandParameter.CHANGELOG_DATE_PATTERN, datePattern ); }
public ScmBranchParameters getScmBranchParameters( CommandParameter parameter ) throws ScmException { return (ScmBranchParameters) getObject( ScmBranchParameters.class, parameter, new ScmBranchParameters() ); }
public String getDatePattern() throws ScmException { return parameters.getString( CommandParameter.CHANGELOG_DATE_PATTERN, null ); }
/** * Provided to allow removeRepo() to be called. * @see junit.framework.TestCase#tearDown() */ @Override protected void tearDown() throws Exception { super.tearDown(); removeRepo(); }
public Date getStartDate() throws ScmException { return parameters.getDate( CommandParameter.START_DATE ); }
/** * Set a parameter value. * * @param parameter The parameter name * @param date The value of the parameter * @throws ScmException if the parameter already exist */ public void setDate( CommandParameter parameter, Date date ) throws ScmException { setObject( parameter, date ); }
/** * @param parameter not null * @return an array of files * @throws ScmException if any */ public File[] getFileArray( CommandParameter parameter ) throws ScmException { return (File[]) getObject( File[].class, parameter ); }
public ScmTagParameters getScmTagParameters( CommandParameter parameter ) throws ScmException { return (ScmTagParameters) getObject( ScmTagParameters.class, parameter, new ScmTagParameters() ); }
protected void assertResultIsSuccess( ScmResult result ) { if ( result.isSuccess() ) { return; } printOutputError( result ); fail( "The command result success flag was false." ); }
public ScmBranchParameters getScmBranchParameters( CommandParameter parameter ) throws ScmException { return (ScmBranchParameters) getObject( ScmBranchParameters.class, parameter, new ScmBranchParameters() ); }
/** * Provided to allow removeRepo() to be called. * @see junit.framework.TestCase#tearDown() */ @Override protected void tearDown() throws Exception { super.tearDown(); removeRepo(); }
public void setScmTagParameters( CommandParameter parameter, ScmTagParameters scmTagParameters ) throws ScmException { setObject( parameter, scmTagParameters ); }