Beispiel #1
0
    def _summarize(self, config, _):
        """ Method uses external binary svndbadmin from viewvc 
            to update the viewvc database with changes 
            
            :param config: The config that has to be used.
            :type config: Config instance.
        """

        repo_path = self.transaction.repos_path
        svndbadmin_bin = config.svndbadmin_bin
        command = svndbadmin_bin + " update " + repo_path

        process.execute(command)
Beispiel #2
0
    def _summarize(self, config, _):
        """ Method uses external binary svndbadmin from viewvc 
            to update the viewvc database with changes 
            
            :param config: The config that has to be used.
            :type config: Config instance.
        """
        
        repo_path = self.transaction.repos_path
        svndbadmin_bin = config.svndbadmin_bin
        command = svndbadmin_bin + " update " + repo_path

        process.execute(command)
Beispiel #3
0
def test_execute_raw_out():
    patcher = mock.patch("repoguard.core.process.subprocess.Popen")
    popen_class = patcher.start()
    try:
        popen_class.return_value.returncode = 0
        popen_class.return_value.communicate.return_value = ("output")
        output = process.execute("svnlook help", raw_out=True)
        assert isinstance(output, str) 
    finally:
        patcher.stop()
Beispiel #4
0
def test_execute_raw_out():
    patcher = mock.patch("repoguard.core.process.subprocess.Popen")
    popen_class = patcher.start()
    try:
        popen_class.return_value.returncode = 0
        popen_class.return_value.communicate.return_value = ("output")
        output = process.execute("svnlook help", raw_out=True)
        assert isinstance(output, str)
    finally:
        patcher.stop()
Beispiel #5
0
 def _run(self, config):
     """
     Method is called when the check has to run.
     
     :param config: The configuration that has to be used by the check.
     :type config: Config
     
     :return: Returns an error or success messages by calling the success
              or error method.
     :rtype: Tuple that contains the success or error code and message.
     """
     
     files = self.transaction.get_files(
         config.check_files, config.ignore_files
     )
     
     files = " ".join([
         self.transaction.get_file(filename) 
         for filename, attribute in files.iteritems() 
              if attribute in ["A", "U", "UU"]
     ])
     
     if files:
         command = self.pattern % (
             config.java, config.classpath, config.config_file, files
         )
         
         self.logger.debug("Running command: %s", command)
         try:
             process.execute(command)
         except process.ProcessException, exc:
             msg = "Coding style errors found:\n\n"
             msg += exc.output + "\n"
             msg += """
                 See Checkstyle documentation for a detailed description: 
                 http://checkstyle.sourceforge.net/
             """
             return self.error(msg)
Beispiel #6
0
    def _run(self, config):
        """
        Method is called when the check has to run.
        
        :param config: The configuration that has to be used by the check.
        :type config: Config
        
        :return: Returns an error or success messages by calling the success
                 or error method.
        :rtype: Tuple that contains the success or error code and message.
        """

        files = self.transaction.get_files(config.check_files,
                                           config.ignore_files)

        files = " ".join([
            self.transaction.get_file(filename)
            for filename, attribute in files.iteritems()
            if attribute in ["A", "U", "UU"]
        ])

        if files:
            command = self.pattern % (config.java, config.classpath,
                                      config.config_file, files)

            self.logger.debug("Running command: %s", command)
            try:
                process.execute(command)
            except process.ProcessException, exc:
                msg = "Coding style errors found:\n\n"
                msg += exc.output + "\n"
                msg += """
                    See Checkstyle documentation for a detailed description: 
                    http://checkstyle.sourceforge.net/
                """
                return self.error(msg)
Beispiel #7
0
 def _execute_svn(self, command, arg="", split=False):
     if self.txn_name is None:
         command = 'svnlook %s "%s" %s' % (command, self.repos_path, arg)
     else:
         command = 'svnlook --%s %s %s "%s" %s' % (self.type, self.txn_name, command, self.repos_path, arg)
     
     if command in self.cache:
         return self.cache[command]
     
     try:
         output = process.execute(command, raw_out=True)
     except process.ProcessException, error:
         if "Transaction '(null)'" in error.output: # Nothing bad happened we just have an empty repository
             output = ""
         else:
             raise
Beispiel #8
0
    def _execute_svn(self, command, arg="", split=False):
        if self.txn_name is None:
            command = 'svnlook %s "%s" %s' % (command, self.repos_path, arg)
        else:
            command = 'svnlook --%s %s %s "%s" %s' % (
                self.type, self.txn_name, command, self.repos_path, arg)

        if command in self.cache:
            return self.cache[command]

        try:
            output = process.execute(command, raw_out=True)
        except process.ProcessException, error:
            if "Transaction '(null)'" in error.output:  # Nothing bad happened we just have an empty repository
                output = ""
            else:
                raise