Beispiel #1
0
    def run(self):
        git_log_r = subprocess.Popen(
            filter(None, [
                "git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE",
                "--stat=100000,8192", "--no-merges", "-w",
                interval.get_since(),
                interval.get_until(), "--date=short"
            ] + (["-C", "-C", "-M"] if self.hard else []) +
                   [self.first_hash + self.second_hash]),
            bufsize=1,
            stdout=subprocess.PIPE).stdout
        lines = git_log_r.readlines()
        git_log_r.close()

        commit = None
        found_valid_extension = False
        is_filtered = False
        commits = []

        __changes_lock__.acquire(
        )  # Global lock used to protect calls from here...

        for i in lines:
            j = i.strip().decode("unicode_escape", "ignore")
            j = j.encode("latin-1", "replace")
            j = j.decode("utf-8", "replace")

            if Commit.is_commit_line(j):
                (author, email) = Commit.get_author_and_email(j)
                self.changes.emails_by_author[author] = email
                self.changes.authors_by_email[email] = author

            if Commit.is_commit_line(j) or i is lines[-1]:
                if found_valid_extension:
                    commits.append(commit)

                found_valid_extension = False
                is_filtered = False
                commit = Commit(j)

                if Commit.is_commit_line(j) and \
                   (filtering.set_filtered(commit.author, "author") or \
                   filtering.set_filtered(commit.email, "email") or \
                   filtering.set_filtered(commit.sha, "revision") or \
                   filtering.set_filtered(commit.sha, "message")):
                    is_filtered = True

            if FileDiff.is_filediff_line(j) and not \
               filtering.set_filtered(FileDiff.get_filename(j)) and not is_filtered:
                extensions.add_located(FileDiff.get_extension(j))

                if FileDiff.is_valid_extension(j):
                    found_valid_extension = True
                    filediff = FileDiff(j)
                    commit.add_filediff(filediff)

        self.changes.commits[self.offset // CHANGES_PER_THREAD] = commits
        __changes_lock__.release()  # ...to here.
        __thread_lock__.release(
        )  # Lock controlling the number of threads running
	def __init__(self, hard):
		self.commits = []
		git_log_r = subprocess.Popen("git log --pretty=\"%cd|%H|%aN|%s\" --stat=100000,8192 --no-merges -w " +
		                             interval.get_since() + interval.get_until() +
		                             "{0} --date=short".format("-C -C -M" if hard else ""),
		                             shell=True, bufsize=1, stdout=subprocess.PIPE).stdout
		commit = None
		found_valid_extension = False
		lines = git_log_r.readlines()

		for i in lines:
			i = codecs.getdecoder("unicode_escape")(i.strip())[0]
			i = i.encode("latin-1", "replace")
			i = i.decode("utf-8", "replace")

			if Commit.is_commit_line(i) or i == lines[-1]:
				if found_valid_extension:
					self.commits.append(commit)

				found_valid_extension = False
				commit = Commit(i)

			if FileDiff.is_filediff_line(i) and not filtering.set_filtered(FileDiff.get_filename(i)):
				extensions.add_located(FileDiff.get_extension(i))

				if FileDiff.is_valid_extension(i):
					found_valid_extension = True
					filediff = FileDiff(i)
					commit.add_filediff(filediff)

		if interval.has_interval() and len(self.commits) > 0:
			interval.set_ref(self.commits[0].sha)
Beispiel #3
0
	def run(self):
		git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE",
		                             "--stat=100000,8192", "--no-merges", "-w", interval.get_since(),
		                             interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
		                             [self.first_hash + self.second_hash]), bufsize=1, stdout=subprocess.PIPE).stdout
		lines = git_log_r.readlines()
		git_log_r.close()

		commit = None
		found_valid_extension = False
		is_filtered = False
		commits = []

		__changes_lock__.acquire() # Global lock used to protect calls from here...

		for i in lines:
			j = i.strip().decode("unicode_escape", "ignore")
			j = j.encode("latin-1", "replace")
			j = j.decode("utf-8", "replace")

			if Commit.is_commit_line(j):
				(author, email) = Commit.get_author_and_email(j)
				self.changes.emails_by_author[author] = email
				self.changes.authors_by_email[email] = author

			if Commit.is_commit_line(j) or i is lines[-1]:
				if found_valid_extension:
					commits.append(commit)

				found_valid_extension = False
				is_filtered = False
				commit = Commit(j)

				if Commit.is_commit_line(j) and \
				   (filtering.set_filtered(commit.author, "author") or \
				   filtering.set_filtered(commit.email, "email") or \
				   filtering.set_filtered(commit.sha, "revision") or \
				   filtering.set_filtered(commit.sha, "message")):
					is_filtered = True

			if FileDiff.is_filediff_line(j) and not \
			   filtering.set_filtered(FileDiff.get_filename(j)) and not is_filtered:
				extensions.add_located(FileDiff.get_extension(j))

				if FileDiff.is_valid_extension(j):
					found_valid_extension = True
					filediff = FileDiff(j)
					commit.add_filediff(filediff)

		self.changes.commits[self.offset // CHANGES_PER_THREAD] = commits
		__changes_lock__.release() # ...to here.
		__thread_lock__.release() # Lock controlling the number of threads running
Beispiel #4
0
    def __init__(self, hard):
        self.commits = []
        git_log_r = subprocess.Popen(
            "git log --reverse --pretty=\"%cd|%H|%aN|%aE\" --stat=100000,8192 --no-merges -w "
            + interval.get_since() + interval.get_until() +
            "{0} --date=short".format("-C -C -M" if hard else ""),
            shell=True,
            bufsize=1,
            stdout=subprocess.PIPE).stdout
        commit = None
        found_valid_extension = False
        lines = git_log_r.readlines()

        for i in lines:
            j = i.strip().decode("unicode_escape", "ignore")
            j = j.encode("latin-1", "replace")
            j = j.decode("utf-8", "replace")

            if Commit.is_commit_line(j):
                (author, email) = Commit.get_author_and_email(j)
                self.emails_by_author[author] = email
                self.authors_by_email[email] = author

            if Commit.is_commit_line(j) or i is lines[-1]:
                if found_valid_extension:
                    self.commits.append(commit)

                found_valid_extension = False
                commit = Commit(j)

            if FileDiff.is_filediff_line(j) and not filtering.set_filtered(FileDiff.get_filename(j)) and not \
               filtering.set_filtered(commit.author, "author") and not filtering.set_filtered(commit.email, "email") and not \
               filtering.set_filtered(commit.sha, "revision"):
                extensions.add_located(FileDiff.get_extension(j))

                if FileDiff.is_valid_extension(j):
                    found_valid_extension = True
                    filediff = FileDiff(j)
                    commit.add_filediff(filediff)

        if interval.has_interval() and len(self.commits) > 0:
            interval.set_ref(self.commits[0].sha)

        if len(self.commits) > 0:
            self.first_commit_date = datetime.date(
                int(self.commits[0].date[0:4]), int(self.commits[0].date[5:7]),
                int(self.commits[0].date[8:10]))
            self.last_commit_date = datetime.date(
                int(self.commits[-1].date[0:4]),
                int(self.commits[-1].date[5:7]),
                int(self.commits[-1].date[8:10]))
Beispiel #5
0
	def __init__(self, hard):
		self.commits = []
		git_log_r = subprocess.Popen("git log --reverse --pretty=\"%cd|%H|%aN|%aE\" --stat=100000,8192 --no-merges -w " +
		                             interval.get_since() + interval.get_until() +
		                             "{0} --date=short".format("-C -C -M" if hard else ""),
		                             shell=True, bufsize=1, stdout=subprocess.PIPE).stdout
		commit = None
		found_valid_extension = False
		lines = git_log_r.readlines()

		for i in lines:
			j = i.strip().decode("unicode_escape", "ignore")
			j = j.encode("latin-1", "replace")
			j = j.decode("utf-8", "replace")

			if Commit.is_commit_line(j):
				(author, email) = Commit.get_author_and_email(j)
				self.emails_by_author[author] = email
				self.authors_by_email[email] = author

			if Commit.is_commit_line(j) or i is lines[-1]:
				if found_valid_extension:
					self.commits.append(commit)

				found_valid_extension = False
				commit = Commit(j)

			if FileDiff.is_filediff_line(j) and not filtering.set_filtered(FileDiff.get_filename(j)) and not \
			   filtering.set_filtered(commit.author, "author") and not filtering.set_filtered(commit.email, "email") and not \
			   filtering.set_filtered(commit.sha, "revision"):
				extensions.add_located(FileDiff.get_extension(j))

				if FileDiff.is_valid_extension(j):
					found_valid_extension = True
					filediff = FileDiff(j)
					commit.add_filediff(filediff)

		if interval.has_interval() and len(self.commits) > 0:
			interval.set_ref(self.commits[0].sha)

		if len(self.commits) > 0:
			self.first_commit_date = datetime.date(int(self.commits[0].date[0:4]), int(self.commits[0].date[5:7]),
			                                       int(self.commits[0].date[8:10]))
			self.last_commit_date = datetime.date(int(self.commits[-1].date[0:4]), int(self.commits[-1].date[5:7]),
			                                       int(self.commits[-1].date[8:10]))
Beispiel #6
0
    def __init__(self, hard):
        self.commits = []
        git_log_r = subprocess.Popen(
            "git log --pretty=\"%cd|%H|%aN|%s\" --stat=100000,8192 --no-merges -w "
            + interval.get_since() + interval.get_until() +
            "{0} --date=short".format("-C -C -M" if hard else ""),
            shell=True,
            bufsize=1,
            stdout=subprocess.PIPE).stdout
        commit = None
        found_valid_extension = False
        lines = git_log_r.readlines()

        for i in lines:
            i = codecs.getdecoder("unicode_escape")(i.strip())[0]
            i = i.encode("latin-1", "replace")
            i = i.decode("utf-8", "replace")

            if Commit.is_commit_line(i) or i == lines[-1]:
                if found_valid_extension:
                    self.commits.append(commit)

                found_valid_extension = False
                commit = Commit(i)

            if FileDiff.is_filediff_line(i) and not filtering.set_filtered(
                    FileDiff.get_filename(i)):
                extensions.add_located(FileDiff.get_extension(i))

                if FileDiff.is_valid_extension(i):
                    found_valid_extension = True
                    filediff = FileDiff(i)
                    commit.add_filediff(filediff)

        if interval.has_interval() and len(self.commits) > 0:
            interval.set_ref(self.commits[0].sha)
Beispiel #7
0
    def __init__(self, repo, hard):
        self.commits = []
        f = sysrun.run(
            repo,
            "git log --pretty='%ad|%t|%aN|%s' --stat=100000 --no-merges --ignore-space-change "
            + "-C {0} --date=short".format("-C" if hard else ""))
        commit = None
        found_valid_extension = False

        for i in f.readlines():
            if Commit.is_commit_line(i):
                if found_valid_extension:
                    self.commits.append(commit)

                found_valid_extension = False
                commit = Commit(i)

            if FileDiff.is_filediff_line(i):
                extensions.add_located(FileDiff.get_extension(i))

                if FileDiff.is_valid_extension(i):
                    found_valid_extension = True
                    filediff = FileDiff(i)
                    commit.add_filediff(filediff)