mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
fix another npe on empty repository
This commit is contained in:
@@ -36,6 +36,7 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
@@ -47,6 +48,7 @@ import sonia.scm.repository.spi.javahg.HgLogChangesetCommand;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,6 +143,9 @@ public class HgLogCommand extends AbstractCommand implements LogCommand
|
|||||||
HgLogChangesetCommand.on(repository).rev("tip").singleRevision();
|
HgLogChangesetCommand.on(repository).rev("tip").singleRevision();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (start >= 0)
|
||||||
|
{
|
||||||
|
|
||||||
int total = start - end + 1;
|
int total = start - end + 1;
|
||||||
|
|
||||||
if (request.getPagingStart() > 0)
|
if (request.getPagingStart() > 0)
|
||||||
@@ -163,6 +168,13 @@ public class HgLogCommand extends AbstractCommand implements LogCommand
|
|||||||
|
|
||||||
result = new ChangesetPagingResult(total, changesets);
|
result = new ChangesetPagingResult(total, changesets);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// empty repository
|
||||||
|
result = new ChangesetPagingResult(0, new ArrayList<Changeset>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,11 @@ public class HgLogChangesetCommand extends AbstractCommand
|
|||||||
*/
|
*/
|
||||||
public int singleRevision(String... files)
|
public int singleRevision(String... files)
|
||||||
{
|
{
|
||||||
return Utils.single(loadRevisions(files));
|
Integer rev = Utils.single(loadRevisions(files));
|
||||||
|
if ( rev == null ){
|
||||||
|
rev = -1;
|
||||||
|
}
|
||||||
|
return rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user