Пример #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)
Пример #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
Пример #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]))
Пример #5
0
    def __init__(self, hard):
        self.commits = []
        git_log_hashes_r = subprocess.Popen(filter(None, [
            "git", "rev-list", "--reverse", "--no-merges",
            interval.get_since(),
            interval.get_until(), "HEAD"
        ]),
                                            bufsize=1,
                                            stdout=subprocess.PIPE).stdout
        lines = git_log_hashes_r.readlines()
        git_log_hashes_r.close()

        if len(lines) > 0:
            self.commits = [None] * (len(lines) // CHANGES_PER_THREAD + 1)
            first_hash = ""

            for i, entry in enumerate(lines):
                if i % CHANGES_PER_THREAD == CHANGES_PER_THREAD - 1:
                    entry = entry.decode("utf-8", "replace").strip()
                    second_hash = entry
                    ChangesThread.create(hard, self, first_hash, second_hash,
                                         i)
                    first_hash = entry + ".."
            else:
                entry = entry.decode("utf-8", "replace").strip()
                second_hash = entry
                ChangesThread.create(hard, self, first_hash, second_hash, i)

        # Make sure all threads have completed.
        for i in range(0, NUM_THREADS):
            __thread_lock__.acquire()

        self.commits = [item for sublist in self.commits for item in sublist]

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

            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]))
Пример #6
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]))
Пример #7
0
	def __init__(self, hard):
		self.commits = []
		git_log_hashes_r = subprocess.Popen(filter(None, ["git", "rev-list", "--reverse", "--no-merges",
		                                    interval.get_since(), interval.get_until(), "HEAD"]), bufsize=1,
		                                    stdout=subprocess.PIPE).stdout
		lines = git_log_hashes_r.readlines()
		git_log_hashes_r.close()

		if len(lines) > 0:
			self.commits = [None] * (len(lines) // CHANGES_PER_THREAD + 1)
			first_hash = ""

			for i, entry in enumerate(lines):
				if i % CHANGES_PER_THREAD == CHANGES_PER_THREAD - 1:
					entry = entry.decode("utf-8", "replace").strip()
					second_hash = entry
					ChangesThread.create(hard, self, first_hash, second_hash, i)
					first_hash = entry + ".."
			else:
				entry = entry.decode("utf-8", "replace").strip()
				second_hash = entry
				ChangesThread.create(hard, self, first_hash, second_hash, i)

		# Make sure all threads have completed.
		for i in range(0, NUM_THREADS):
			__thread_lock__.acquire()

		self.commits = [item for sublist in self.commits for item in sublist]

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

			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]))
Пример #8
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)