James Moger
2012-03-23 5b29c53b326b5fd283cb06356e94df5f78508860
src/com/gitblit/FederationPullExecutor.java
@@ -49,6 +49,7 @@
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.TeamModel;
import com.gitblit.models.UserModel;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.FederationUtils;
import com.gitblit.utils.FileUtils;
import com.gitblit.utils.JGitUtils;
@@ -271,6 +272,17 @@
               federationSets.addAll(repository.federationSets);
            }
            repository.federationSets = new ArrayList<String>(federationSets);
            // merge indexed branches
            Set<String> indexedBranches = new HashSet<String>();
            if (rm.indexedBranches != null) {
               indexedBranches.addAll(rm.indexedBranches);
            }
            if (repository.indexedBranches != null) {
               indexedBranches.addAll(repository.indexedBranches);
            }
            repository.indexedBranches = new ArrayList<String>(indexedBranches);
         }
         // only repositories that are actually _cloned_ from the origin
         // Gitblit repository are marked as federated. If the origin
@@ -339,7 +351,7 @@
                     // update team repositories
                     TeamModel remoteTeam = user.getTeam(teamname);
                     if (remoteTeam != null && remoteTeam.repositories != null) {
                     if (remoteTeam != null && !ArrayUtils.isEmpty(remoteTeam.repositories)) {
                        int before = team.repositories.size();
                        team.addRepositories(remoteTeam.repositories);
                        int after = team.repositories.size();
@@ -399,7 +411,7 @@
               "Failed to retrieve SETTINGS from federated gitblit ({0} @ {1})",
               registration.name, registration.url), e);
      }
      try {
         // Pull SCRIPTS
         Map<String, String> scripts = FederationUtils.getScripts(registration);
@@ -407,9 +419,10 @@
            for (Map.Entry<String, String> script : scripts.entrySet()) {
               String scriptName = script.getKey();
               if (scriptName.endsWith(".groovy")) {
                  scriptName = scriptName.substring(0,  scriptName.indexOf(".groovy"));
                  scriptName = scriptName.substring(0, scriptName.indexOf(".groovy"));
               }
               File file = new File(registrationFolderFile, registration.name + "_" + scriptName + ".groovy");
               File file = new File(registrationFolderFile, registration.name + "_"
                     + scriptName + ".groovy");
               FileUtils.writeContent(file, script.getValue());
            }
         }