James Moger
2011-12-27 0fb1fd48c430d5dbb61485a9a6c6f52aac200e09
src/com/gitblit/GitBlit.java
@@ -25,6 +25,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -904,6 +905,11 @@
                           .format("Can not rename repository ''{0}'' to ''{1}'' because ''{1}'' already exists.",
                                 repositoryName, repository.name));
            }
            File parentFile = destFolder.getParentFile();
            if (!parentFile.exists() && !parentFile.mkdirs()) {
               throw new GitBlitException(MessageFormat.format(
                     "Failed to create folder ''{0}''", parentFile.getAbsolutePath()));
            }
            if (!folder.renameTo(destFolder)) {
               throw new GitBlitException(MessageFormat.format(
                     "Failed to rename repository ''{0}'' to ''{1}''.", repositoryName,
@@ -1478,6 +1484,30 @@
      }
      return scripts;
   }
   public List<String> getInheritedPreReceiveScripts(RepositoryModel repository) {
      Set<String> globals = new HashSet<String>();
      for (String script : getStrings(Keys.groovy.preReceiveScripts)) {
         if (script.endsWith(".groovy")) {
            globals.add(script.substring(0, script.lastIndexOf('.')));
         } else {
            globals.add(script);
         }
      }
      return new ArrayList<String>(globals);
   }
   public List<String> getInheritedPostReceiveScripts(RepositoryModel repository) {
      Set<String> globals = new HashSet<String>();
      for (String script : getStrings(Keys.groovy.postReceiveScripts)) {
         if (script.endsWith(".groovy")) {
            globals.add(script.substring(0, script.lastIndexOf('.')));
         } else {
            globals.add(script);
         }
      }
      return new ArrayList<String>(globals);
   }
   /**
    * Notify the administrators by email.
@@ -1505,7 +1535,7 @@
    * @param message
    * @param toAddresses
    */
   public void sendMail(String subject, String message, ArrayList<String> toAddresses) {
   public void sendMail(String subject, String message, Collection<String> toAddresses) {
      this.sendMail(subject, message, toAddresses.toArray(new String[0]));
   }