final ScmProvider provider) throws ScmException
{
try
{
ChangeLogScmResult result = null;
ScmRevision endRev = null;
ScmRevision startRev = null;
ScmFileSet fileSet = createFileSet();
InfoScmResult isr = provider.info(repository.getProviderRepository(), fileSet, null);
if (isr != null)
{
for (InfoItem ii : isr.getInfoItems())
{
if (StringUtils.isNotEmpty(ii.getRevision()))
{
// HG places a trailing + which confuses the scm provider.
endRev = new ScmRevision (ii.getRevision().replaceAll("\\+$", ""));
}
}
}
int currentRange = queryRangeInDays;
if (repository.getProvider().equals("git"))
{
// Git can't handle x->x so use an inbuilt shortcut.
startRev = new ScmRevision ("HEAD^");
}
else if (repository.getProvider().equals("svn"))
{
// Annoyingly the SCM provider almost always adds the URL which prevents the use of BASE.
// Hence the hacky shortcut.
startRev = endRev;
endRev = new ScmRevision ("1");
}
else if (repository.getProvider().equals("hg") &&
endRev.getName().contains("abort: there is no Mercurial repository here"))
{
// Unable to locate a HG repository.