mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 08:38:26 +01:00
Use subprocess.Popen default buffer size
This commit is contained in:
parent
3c7d252a67
commit
61173c4caf
8 changed files with 14 additions and 14 deletions
|
@ -34,7 +34,7 @@ def get_basedir_git(path=None):
|
||||||
previous_directory = os.getcwd()
|
previous_directory = os.getcwd()
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
|
|
||||||
bare_command = subprocess.Popen(["git", "rev-parse", "--is-bare-repository"], bufsize=1,
|
bare_command = subprocess.Popen(["git", "rev-parse", "--is-bare-repository"],
|
||||||
stdout=subprocess.PIPE, stderr=open(os.devnull, "w"))
|
stdout=subprocess.PIPE, stderr=open(os.devnull, "w"))
|
||||||
|
|
||||||
isbare = bare_command.stdout.readlines()
|
isbare = bare_command.stdout.readlines()
|
||||||
|
@ -47,9 +47,9 @@ def get_basedir_git(path=None):
|
||||||
absolute_path = None
|
absolute_path = None
|
||||||
|
|
||||||
if isbare:
|
if isbare:
|
||||||
absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout
|
absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], stdout=subprocess.PIPE).stdout
|
||||||
else:
|
else:
|
||||||
absolute_path = subprocess.Popen(["git", "rev-parse", "--show-toplevel"], bufsize=1,
|
absolute_path = subprocess.Popen(["git", "rev-parse", "--show-toplevel"],
|
||||||
stdout=subprocess.PIPE).stdout
|
stdout=subprocess.PIPE).stdout
|
||||||
|
|
||||||
absolute_path = absolute_path.readlines()
|
absolute_path = absolute_path.readlines()
|
||||||
|
|
|
@ -91,7 +91,7 @@ class BlameThread(threading.Thread):
|
||||||
__blame_lock__.release() # ...to here.
|
__blame_lock__.release() # ...to here.
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
git_blame_r = subprocess.Popen(self.blame_command, bufsize=1, stdout=subprocess.PIPE).stdout
|
git_blame_r = subprocess.Popen(self.blame_command, stdout=subprocess.PIPE).stdout
|
||||||
rows = git_blame_r.readlines()
|
rows = git_blame_r.readlines()
|
||||||
git_blame_r.close()
|
git_blame_r.close()
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ PROGRESS_TEXT = N_("Checking how many rows belong to each author (2 of 2): {0:.0
|
||||||
class Blame(object):
|
class Blame(object):
|
||||||
def __init__(self, repo, hard, useweeks, changes):
|
def __init__(self, repo, hard, useweeks, changes):
|
||||||
self.blames = {}
|
self.blames = {}
|
||||||
ls_tree_p = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
|
ls_tree_p = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
lines = ls_tree_p.communicate()[0].splitlines()
|
lines = ls_tree_p.communicate()[0].splitlines()
|
||||||
ls_tree_p.stdout.close()
|
ls_tree_p.stdout.close()
|
||||||
|
|
|
@ -125,7 +125,7 @@ class ChangesThread(threading.Thread):
|
||||||
git_log_r = subprocess.Popen([_f for _f in ["git", "log", "--reverse", "--pretty=%ct|%cd|%H|%aN|%aE",
|
git_log_r = subprocess.Popen([_f for _f in ["git", "log", "--reverse", "--pretty=%ct|%cd|%H|%aN|%aE",
|
||||||
"--stat=100000,8192", "--no-merges", "-w", interval.get_since(),
|
"--stat=100000,8192", "--no-merges", "-w", interval.get_since(),
|
||||||
interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
|
interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
|
||||||
[self.first_hash + self.second_hash] if _f], bufsize=1, stdout=subprocess.PIPE).stdout
|
[self.first_hash + self.second_hash] if _f], stdout=subprocess.PIPE).stdout
|
||||||
lines = git_log_r.readlines()
|
lines = git_log_r.readlines()
|
||||||
git_log_r.close()
|
git_log_r.close()
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class Changes(object):
|
||||||
self.commits = []
|
self.commits = []
|
||||||
interval.set_ref("HEAD");
|
interval.set_ref("HEAD");
|
||||||
git_rev_list_p = subprocess.Popen([_f for _f in ["git", "rev-list", "--reverse", "--no-merges",
|
git_rev_list_p = subprocess.Popen([_f for _f in ["git", "rev-list", "--reverse", "--no-merges",
|
||||||
interval.get_since(), interval.get_until(), "HEAD"] if _f], bufsize=1,
|
interval.get_since(), interval.get_until(), "HEAD"] if _f],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
lines = git_rev_list_p.communicate()[0].splitlines()
|
lines = git_rev_list_p.communicate()[0].splitlines()
|
||||||
git_rev_list_p.stdout.close()
|
git_rev_list_p.stdout.close()
|
||||||
|
|
|
@ -42,7 +42,7 @@ def create(url):
|
||||||
if parsed_url.scheme == "file" or parsed_url.scheme == "git" or parsed_url.scheme == "http" or \
|
if parsed_url.scheme == "file" or parsed_url.scheme == "git" or parsed_url.scheme == "http" or \
|
||||||
parsed_url.scheme == "https" or parsed_url.scheme == "ssh":
|
parsed_url.scheme == "https" or parsed_url.scheme == "ssh":
|
||||||
path = tempfile.mkdtemp(suffix=".gitinspector")
|
path = tempfile.mkdtemp(suffix=".gitinspector")
|
||||||
git_clone = subprocess.Popen(["git", "clone", url, path], bufsize=1, stdout=sys.stderr)
|
git_clone = subprocess.Popen(["git", "clone", url, path], stdout=sys.stderr)
|
||||||
git_clone.wait()
|
git_clone.wait()
|
||||||
|
|
||||||
if git_clone.returncode != 0:
|
if git_clone.returncode != 0:
|
||||||
|
|
|
@ -32,7 +32,7 @@ class GitConfig(object):
|
||||||
previous_directory = os.getcwd()
|
previous_directory = os.getcwd()
|
||||||
os.chdir(self.repo)
|
os.chdir(self.repo)
|
||||||
setting = subprocess.Popen([_f for _f in ["git", "config", "--global" if self.global_only else "",
|
setting = subprocess.Popen([_f for _f in ["git", "config", "--global" if self.global_only else "",
|
||||||
"inspector." + variable] if _f], bufsize=1, stdout=subprocess.PIPE).stdout
|
"inspector." + variable] if _f], stdout=subprocess.PIPE).stdout
|
||||||
os.chdir(previous_directory)
|
os.chdir(previous_directory)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -58,7 +58,7 @@ def has_filtered():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __find_commit_message__(sha):
|
def __find_commit_message__(sha):
|
||||||
git_show_r = subprocess.Popen([_f for _f in ["git", "show", "-s", "--pretty=%B", "-w", sha] if _f], bufsize=1,
|
git_show_r = subprocess.Popen([_f for _f in ["git", "show", "-s", "--pretty=%B", "-w", sha] if _f],
|
||||||
stdout=subprocess.PIPE).stdout
|
stdout=subprocess.PIPE).stdout
|
||||||
|
|
||||||
commit_message = git_show_r.read()
|
commit_message = git_show_r.read()
|
||||||
|
|
|
@ -68,7 +68,7 @@ def init():
|
||||||
|
|
||||||
__enabled__ = True
|
__enabled__ = True
|
||||||
__installed__ = True
|
__installed__ = True
|
||||||
__translation__.install(True)
|
__translation__.install()
|
||||||
|
|
||||||
def check_compatibility(version):
|
def check_compatibility(version):
|
||||||
if isinstance(__translation__, gettext.GNUTranslations):
|
if isinstance(__translation__, gettext.GNUTranslations):
|
||||||
|
@ -103,4 +103,4 @@ def disable():
|
||||||
__enabled__ = False
|
__enabled__ = False
|
||||||
|
|
||||||
if __installed__:
|
if __installed__:
|
||||||
gettext.NullTranslations().install(True)
|
gettext.NullTranslations().install()
|
||||||
|
|
|
@ -44,7 +44,7 @@ class MetricsLogic(object):
|
||||||
self.cyclomatic_complexity = {}
|
self.cyclomatic_complexity = {}
|
||||||
self.cyclomatic_complexity_density = {}
|
self.cyclomatic_complexity_density = {}
|
||||||
|
|
||||||
ls_tree_p = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
|
ls_tree_p = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
lines = ls_tree_p.communicate()[0].splitlines()
|
lines = ls_tree_p.communicate()[0].splitlines()
|
||||||
ls_tree_p.stdout.close()
|
ls_tree_p.stdout.close()
|
||||||
|
@ -57,7 +57,7 @@ class MetricsLogic(object):
|
||||||
|
|
||||||
if FileDiff.is_valid_extension(i) and not filtering.set_filtered(FileDiff.get_filename(i)):
|
if FileDiff.is_valid_extension(i) and not filtering.set_filtered(FileDiff.get_filename(i)):
|
||||||
file_r = subprocess.Popen(["git", "show", interval.get_ref() + ":{0}".format(i.strip())],
|
file_r = subprocess.Popen(["git", "show", interval.get_ref() + ":{0}".format(i.strip())],
|
||||||
bufsize=1, stdout=subprocess.PIPE).stdout.readlines()
|
stdout=subprocess.PIPE).stdout.readlines()
|
||||||
|
|
||||||
extension = FileDiff.get_extension(i)
|
extension = FileDiff.get_extension(i)
|
||||||
lines = MetricsLogic.get_eloc(file_r, extension)
|
lines = MetricsLogic.get_eloc(file_r, extension)
|
||||||
|
|
Loading…
Reference in a new issue