예제 #1
0
    def stat(self, email):
        '''
        returns a statistic of a git author with the given e_mail.

        :param email: name of the author
        :rtype: a dict with the statistics
        '''
        sums = [0, 0, 0]
        for line in Shell.git("log",
                              "--all",
                              "--stat",
                              '--author={0}'.format(email),
                              _tty_in=True,
                              _tty_out=False,
                              _iter=True):
            line = line[:-1]

            if " files changed" in line:
                line = line.replace(" insertions(+)", "")
                line = line.replace(" insertion(+)", "")
                line = line.replace(" deletion(-)", "")
                line = line.replace(" deletions(-)", "")
                line = line.replace(" files changed", "")
                line = line.split(",")
                data = [int(i) for i in line]
                for index in range(0, len(data)):
                    sums[index] += data[index]

        return {
            "email": email,
            "fileschanged": sums[0],
            "inserted": sums[1],
            "deleted": sums[2],
            "lineschanged": sums[1] + sums[2]
        }
예제 #2
0
def get_version_from_git():
    r = Shell.git('tag').split("\n")[-1]
    return r
예제 #3
0
 def version(self):
     '''
     retruns the verison of the code from github
     :rtype: the git tags
     '''
     return str(Shell.git("describe", "--tags"))[:-1]