From: James Moger Date: Mon, 8 Sep 2014 20:39:02 +0000 (-0400) Subject: Fix MigrateTickets failure for view-restricted repositories X-Git-Tag: v1.6.1~37^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e58e09a9a944a7aeadf4f953ead9eca73403ac5c;p=gitblit.git Fix MigrateTickets failure for view-restricted repositories --- diff --git a/src/main/java/com/gitblit/MigrateTickets.java b/src/main/java/com/gitblit/MigrateTickets.java index 94284ee2..b08228ef 100644 --- a/src/main/java/com/gitblit/MigrateTickets.java +++ b/src/main/java/com/gitblit/MigrateTickets.java @@ -170,7 +170,7 @@ public class MigrateTickets { long start = System.nanoTime(); long totalTickets = 0; long totalChanges = 0; - for (RepositoryModel repository : repositoryManager.getRepositoryModels(null)) { + for (RepositoryModel repository : repositoryManager.getRepositoryModels()) { Set ids = inputService.getIds(repository); if (ids == null || ids.isEmpty()) { // nothing to migrate diff --git a/src/main/java/com/gitblit/manager/GitblitManager.java b/src/main/java/com/gitblit/manager/GitblitManager.java index 2ed52d67..08853a66 100644 --- a/src/main/java/com/gitblit/manager/GitblitManager.java +++ b/src/main/java/com/gitblit/manager/GitblitManager.java @@ -79,11 +79,11 @@ import com.gitblit.tickets.ITicketService; import com.gitblit.transport.ssh.IPublicKeyManager; import com.gitblit.transport.ssh.SshKey; import com.gitblit.utils.ArrayUtils; -import com.gitblit.utils.XssFilter; import com.gitblit.utils.HttpUtils; import com.gitblit.utils.JsonUtils; import com.gitblit.utils.ObjectCache; import com.gitblit.utils.StringUtils; +import com.gitblit.utils.XssFilter; import com.google.gson.Gson; import com.google.gson.JsonIOException; import com.google.gson.JsonSyntaxException; @@ -981,6 +981,11 @@ public class GitblitManager implements IGitblit { return repositoryManager.getRepository(repositoryName, logError); } + @Override + public List getRepositoryModels() { + return repositoryManager.getRepositoryModels(); + } + @Override public List getRepositoryModels(UserModel user) { return repositoryManager.getRepositoryModels(user); diff --git a/src/main/java/com/gitblit/manager/IRepositoryManager.java b/src/main/java/com/gitblit/manager/IRepositoryManager.java index f5cf03fa..f37612d3 100644 --- a/src/main/java/com/gitblit/manager/IRepositoryManager.java +++ b/src/main/java/com/gitblit/manager/IRepositoryManager.java @@ -194,6 +194,14 @@ public interface IRepositoryManager extends IManager { */ Repository getRepository(String repositoryName, boolean logError); + /** + * Returns the list of all repository models. + * + * @return list of all repository models + * @since 1.6.1 + */ + List getRepositoryModels(); + /** * Returns the list of repository models that are accessible to the user. * diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java index ac9ea156..99441309 100644 --- a/src/main/java/com/gitblit/manager/RepositoryManager.java +++ b/src/main/java/com/gitblit/manager/RepositoryManager.java @@ -624,6 +624,27 @@ public class RepositoryManager implements IRepositoryManager { return r; } + /** + * Returns the list of all repository models. + * + * @return list of all repository models + */ + @Override + public List getRepositoryModels() { + long methodStart = System.currentTimeMillis(); + List list = getRepositoryList(); + List repositories = new ArrayList(); + for (String repo : list) { + RepositoryModel model = getRepositoryModel(repo); + if (model != null) { + repositories.add(model); + } + } + long duration = System.currentTimeMillis() - methodStart; + logger.info(MessageFormat.format("{0} repository models loaded in {1} msecs", duration)); + return repositories; + } + /** * Returns the list of repository models that are accessible to the user. *