Beispiel #1
0
    def is_a_svn_repo(self):
        exit_code, stdout, stderr = execute_command_and_capture_output(
            "svn", "status")
        if "not a working copy" in stderr or exit_code != 0:
            return False

        return True
Beispiel #2
0
 def get_svn_revision_count(self):
     exit_code, stdout, stderr = execute_command_and_capture_output(
         "svnversion")
     if exit_code != 0 or "Unversioned directory" in stdout or "Uncommitted" in stdout:
         raise PyBuilderException("Cannot determine svn revision: svnversion failed or unversioned directory:\n{0}".
                                  format(stderr))
     return stdout.strip().replace("M", "").replace("S", "").replace("P", "").split(":")[0]
Beispiel #3
0
 def get_svn_revision_count(self):
     exit_code, stdout, stderr = execute_command_and_capture_output(
         "svnversion")
     if exit_code != 0 or "Unversioned directory" in stdout or "Uncommitted" in stdout:
         raise PyBuilderException("Cannot determine svn revision: svnversion failed or unversioned directory:\n{0}".
                                  format(stderr))
     return stdout.strip().replace("M", "").replace("S", "").replace("P", "").split(":")[0]
Beispiel #4
0
 def get_git_revision_count(self):
     # NOTE: git rev-list HEAD --count does not work on RHEL6, hence we count ourselves.
     exit_code, stdout, stderr = execute_command_and_capture_output(
         "git", "rev-list", "HEAD")
     if exit_code != 0:
         raise PyBuilderException("Cannot determine git revision: git rev-list HEAD failed:\n{0}".
                                  format(stderr))
     return str(len(stdout.splitlines()))
Beispiel #5
0
 def get_git_revision_count(self):
     # NOTE: git rev-list HEAD --count does not work on RHEL6, hence we count ourselves.
     exit_code, stdout, stderr = execute_command_and_capture_output(
         "git", "rev-list", "HEAD")
     if exit_code != 0:
         raise PyBuilderException("Cannot determine git revision: git rev-list HEAD failed:\n{0}".
                                  format(stderr))
     return str(len(stdout.splitlines()))
Beispiel #6
0
 def get_git_hash(self, abbreviate=7):
     if self.is_a_git_repo():
         exit_code, stdout, stderr = execute_command_and_capture_output(
             "git", "rev-parse", "--short={0}".format(abbreviate), "HEAD")
         if exit_code != 0:
             raise PyBuilderException("Cannot determine git hash: git rev-parse HEAD failed:\n{0}".
                                      format(stderr))
         else:
             return stdout.strip()
     else:
         raise PyBuilderException("Cannot determine git hash: project is not a git repo.")
Beispiel #7
0
 def get_git_description(self):
     if self.is_a_git_repo():
         exit_code, stdout, stderr = execute_command_and_capture_output(
             "git", "describe", "--always", "--tags", "--dirty")
         if exit_code != 0:
             raise PyBuilderException("Cannot determine git description: git describe failed:\n{0}".
                                      format(stderr))
         else:
             return stdout.strip()
     else:
         raise PyBuilderException("Cannot determine git description: project is not a git repo.")
Beispiel #8
0
 def get_git_hash(self, abbreviate=7):
     if self.is_a_git_repo():
         exit_code, stdout, stderr = execute_command_and_capture_output(
             "git", "rev-parse", "--short={0}".format(abbreviate), "HEAD")
         if exit_code != 0:
             raise PyBuilderException("Cannot determine git hash: git rev-parse HEAD failed:\n{0}".
                                      format(stderr))
         else:
             return stdout.strip()
     else:
         raise PyBuilderException("Cannot determine git hash: project is not a git repo.")
Beispiel #9
0
    def is_a_svn_repo(self):
        exit_code, stdout, stderr = execute_command_and_capture_output("svn", "status")
        if "not a working copy" in stderr or exit_code != 0:
            return False

        return True
Beispiel #10
0
 def is_a_git_repo(self):
     exit_code, _, __ = execute_command_and_capture_output("git", "status")
     if exit_code == 0:
         return True
     return False
Beispiel #11
0
 def is_a_git_repo(self):
     exit_code, _, __ = execute_command_and_capture_output("git", "status")
     if exit_code == 0:
         return True
     return False