Completely removed the missing module and the --checkout-missing option.

This is flag should not be needed anymore, as gitinspector always uses
a reference point such as HEAD or some reivision when looking into the
repository (never the file structure directly).
This commit is contained in:
Adam Waldenberg 2013-08-03 10:30:43 +02:00
parent 00fdec2928
commit bc182c6924
6 changed files with 19 additions and 110 deletions

View file

@ -28,7 +28,6 @@ import filtering
import format
import gravatar
import interval
import missing
import multiprocessing
import re
import subprocess
@ -97,7 +96,6 @@ class Blame:
row = row.decode("utf-8", "replace").strip("\"").strip("'").strip()
if FileDiff.is_valid_extension(row) and not filtering.set_filtered(FileDiff.get_filename(row)):
if not missing.add(row):
blame_string = "git blame -e -w {0} ".format("-C -C -M" if hard else "") + \
interval.get_since() + interval.get_ref() + " -- \"" + row + "\""
thread = BlameThread(changes, blame_string, FileDiff.get_extension(row), self.blames, row.strip())

View file

@ -22,7 +22,6 @@ import extensions
import filtering
import format
import interval
import missing
import optval
import os
import subprocess
@ -54,8 +53,6 @@ def __read_git_config_string__(repo, variable):
return (True, string) if len(string) > 0 else (False, None)
def init(run):
missing.set_checkout_missing(__read_git_config_bool__(run.repo, "checkout-missing"))
var = __read_git_config_string__(run.repo, "file-types")
if var[0]:
extensions.define(var[1])

View file

@ -34,7 +34,6 @@ import help
import interval
import getopt
import metrics
import missing
import os
import optval
import outputable
@ -96,7 +95,6 @@ class Runner:
if self.responsibilities:
outputable.output(responsibilities.ResponsibilitiesOutput(self.hard))
outputable.output(missing.Missing())
outputable.output(filtering.Filtering())
if self.list_file_types:
@ -115,11 +113,10 @@ def main():
__run__ = Runner()
try:
__opts__, __args__ = optval.gnu_getopt(argv[1:], "cf:F:hHlLmrTwx:", ["checkout-missing:true", "exclude=",
"file-types=", "format=", "hard:true", "help",
"list-file-types:true", "localize-output:true",
"metrics:true", "responsibilities:true", "since=",
"grading:true", "timeline:true", "until=", "version",
__opts__, __args__ = optval.gnu_getopt(argv[1:], "f:F:hHlLmrTwx:", ["exclude=", "file-types=", "format=",
"hard:true", "help", "list-file-types:true",
"localize-output:true", "metrics:true", "responsibilities:true",
"since=", "grading:true", "timeline:true", "until=", "version",
"weeks:true"])
for arg in __args__:
__run__.repo = arg
@ -129,11 +126,7 @@ def main():
clear_x_on_next_pass = True
for o, a in __opts__:
if o == "-c":
missing.set_checkout_missing(True)
elif o == "--checkout-missing":
missing.set_checkout_missing(optval.get_boolean_argument(a))
elif o in("-h", "--help"):
if o in("-h", "--help"):
help.output()
sys.exit(0)
elif o in("-f", "--file-types"):

View file

@ -30,7 +30,6 @@ given, information will be fetched from the last directory specified.
Mandatory arguments to long options are mandatory for short options too.
Boolean arguments can only be given to long options.
-c, --checkout-missing[=BOOL] try to checkout any missing files
-f, --file-types=EXTENSIONS a comma separated list of file extensions to
include when computing statistics. The
default extensions used are:

View file

@ -25,7 +25,6 @@ from changes import FileDiff
import comment
import filtering
import interval
import missing
import subprocess
__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300, "php": 500, "py": 500, "glsl": 1000,
@ -43,8 +42,9 @@ class MetricsLogic:
i = i.decode("utf-8", "replace").strip("\"").strip("'").strip()
if FileDiff.is_valid_extension(i) and not filtering.set_filtered(FileDiff.get_filename(i)):
if not missing.add(i):
file_r = open(i.strip(), "rb")
file_r = subprocess.Popen("git show " + interval.get_ref() + ":" + i.strip(), shell=True, bufsize=1,
stdout=subprocess.PIPE).stdout
extension = FileDiff.get_extension(i)
lines = MetricsLogic.get_eloc(file_r, extension)

View file

@ -1,78 +0,0 @@
# coding: utf-8
#
# Copyright © 2012-2013 Ejwa Software. All rights reserved.
#
# This file is part of gitinspector.
#
# gitinspector is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# gitinspector is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from localization import N_
from outputable import Outputable
import interval
import os
import subprocess
import terminal
import textwrap
__checkout_missing__ = False
__missing_files__ = set()
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
def set_checkout_missing(checkout):
global __checkout_missing__
__checkout_missing__ = checkout
MISSING_INFO_TEXT = N_("The following files were missing in the repository and were therefore not "
"completely included in the statistical analysis. To include them, you can "
"either checkout manually using git or use the -c option in gitinspector")
class Missing(Outputable):
def output_html(self):
if __missing_files__:
missing_xml = "<div><div class=\"box\">"
missing_xml += "<p>" + _(MISSING_INFO_TEXT) + ".</p>"
for missing in __missing_files__:
missing_xml += "<p class=\"error\">" + missing + "</p>"
missing_xml += "</div></div>"
print(missing_xml)
def output_text(self):
if __missing_files__:
print("\n" + textwrap.fill(_(MISSING_INFO_TEXT) + ":", width=terminal.get_size()[0]))
for missing in __missing_files__:
(width, _unused) = terminal.get_size()
print("...%s" % missing[-width+3:] if len(missing) > width else missing)
def output_xml(self):
if __missing_files__:
message_xml = "\t\t<message>" + _(MISSING_INFO_TEXT) + "</message>\n"
missing_xml = ""
for missing in __missing_files__:
missing_xml += "\t\t\t<file>" + missing + "</file>\n"
print("\t<missing>\n" + message_xml + "\t\t<files>\n" + missing_xml + "\t\t</files>\n\t</missing>")