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)
コード例 #2
0
ファイル: missing.py プロジェクト: Eric--/cowry
def add(file_name):
	if not interval.has_interval() and not os.path.exists(file_name):
		if __checkout_missing__:
			subprocess.call("git checkout \"" + file_name.strip() + "\"", shell=True)
		else:
			__missing_files__.add(file_name)
			return True
	return False
コード例 #3
0
def add(file_name):
    if not interval.has_interval() and not os.path.exists(file_name):
        if __checkout_missing__:
            subprocess.call("git checkout \"" + file_name.strip() + "\"",
                            shell=True)
        else:
            __missing_files__.add(file_name)
            return True
    return False
コード例 #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
ファイル: changes.py プロジェクト: Rasmusgit/gitinspector
	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
ファイル: changes.py プロジェクト: marham/gitinspector
	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)