Example #1
0
 def get_file_diffs(self, origin, head, **kwargs):
     command = ("git diff-tree --no-commit-id --name-status -r %s %s" %
                (origin, head))
     ret_code, output = Bash.execute_command(command=command)
     if not ret_code:
         return output
     return ""
Example #2
0
 def get_file(self, filename, **kwargs):
     ret_code, output = Bash.execute_command("git show :%s " % filename)
     if not ret_code:
         return output
     else:
         print("Read error file:%s" % filename)
     return None
Example #3
0
 def get_file(self, filename, newrev, **kwargs):
     ret_code, output = Bash.execute_command("git cat-file blob %s:%s " %
                                             (newrev, filename))
     if not ret_code:
         return output
     else:
         print("read error file:%s:%s" % (newrev, filename))
     return None
Example #4
0
 def check_syntax(self, file_desc, filename=""):
     if filename[len(filename) - 4:] != ".php":
         print("%s doesn't end with .php we ignore it" % filename)
         return True
     ret_code, output = Bash.execute_command(command=("php -l %s" %
                                                      file_desc.name))
     if not ret_code:
         return True
     else:
         print("> " + ",".join(output))
         return False
    def check_syntax(self, file_desc, filename=""):

        if filename[len(filename) - 3:] != ".py":
            print("{0} doesn't end with .py we ignore it".format(filename))
            return True

        command = "/usr/local/bin/pyflakes %s" % file_desc.name
        ret_code, output = Bash.execute_command(command=command)
        if not ret_code:
            return True
        else:
            return self.check_error_code_against_pyflakes_exclusion_list(output)
    def check_syntax(self, file_desc, filename=""):

        if filename[len(filename) - 3 :] != ".py":
            print("%s doesn't end with .py we ignore it" % filename)
            return True
        config = os.path.join(self.conf_location, self.PEP8_FILE_NAME)
        command = "pep8 --config=%s %s" % (config, file_desc.name)
        ret_code, output = Bash.execute_command(command=command)
        if not ret_code:
            return True
        else:
            for line in output:
                print("> " + line.replace(file_desc.name, filename))
            return False
    def execute(self, commit_msg_file, **kwargs):
        ret_code, output = Bash.execute_command('git rev-parse --abbrev-ref HEAD')
        if ret_code:
            print('An error occured trying to get the branch name')
            return False

        with open(commit_msg_file, 'r+') as commit_file:
            branch_name = output[0].rstrip('\r\n')
            content = commit_file.read()
            if not content.startswith(branch_name):
                commit_file.seek(0, 0)
                commit_file.write(branch_name + ':' + content)

        return True
Example #8
0
 def get_file_diffs(self, **kwargs):
     command = ("git diff --cached --name-status -r" )
     ret_code, output = Bash.execute_command(command=command)
     if not ret_code:
         return output
     return ""