Exemplo n.º 1
0
def output_header():
    if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
        base = basedir.get_basedir()
        html_header = __output_html_template__(base + "/html/html.header")
        tablesorter_js = __get_zip_file_content__(
            "jquery.tablesorter.min.js",
            "/html/jquery.tablesorter.min.js.zip").encode(
                "latin-1", "replace")
        tablesorter_js = tablesorter_js.decode("utf-8", "ignore")
        flot_js = __get_zip_file_content__("jquery.flot.js")
        pie_js = __get_zip_file_content__("jquery.flot.pie.js")
        resize_js = __get_zip_file_content__("jquery.flot.resize.js")

        logo_file = open(base + "/html/gitinspector_piclet.png", "rb")
        logo = logo_file.read()
        logo_file.close()
        logo = base64.b64encode(logo)

        if __selected_format__ == "htmlembedded":
            jquery_js = ">" + __get_zip_file_content__("jquery.js")
        else:
            jquery_js = " src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js\">"

        print(
            html_header.format(
                title=_("Repository statistics for {0}").format(
                    os.path.basename(basedir.get_basedir_git())),
                jquery=jquery_js,
                jquery_tablesorter=tablesorter_js,
                jquery_flot=flot_js,
                jquery_flot_pie=pie_js,
                jquery_flot_resize=resize_js,
                logo=logo.decode("utf-8", "replace"),
                logo_text=_(
                    "The output has been generated by {0} {1}. The statistical analysis tool"
                    " for git repositories.").
                format(
                    "<a href=\"https://gitinspector.googlecode.com\">gitinspector</a>",
                    version.__version__),
                repo_text=
                _("Statistical information for the repository '{0}' was gathered on {1}."
                  ).format(os.path.basename(basedir.get_basedir_git()),
                           localization.get_date()),
                show_minor_authors=_("Show minor authors"),
                hide_minor_authors=_("Hide minor authors"),
                show_minor_rows=_("Show rows with minor work"),
                hide_minor_rows=_("Hide rows with minor work")))
    elif __selected_format__ == "xml":
        print("<gitinspector>")
        print("\t<version>" + version.__version__ + "</version>")
        print("\t<repository>" + os.path.basename(basedir.get_basedir_git()) +
              "</repository>")
        print("\t<report-date>" + time.strftime("%Y/%m/%d") + "</report-date>")
    else:
        print(
            textwrap.fill(_(
                "Statistical information for the repository '{0}' was gathered on {1}."
            ).format(os.path.basename(basedir.get_basedir_git()),
                     localization.get_date()),
                          width=terminal.get_size()[0]))
Exemplo n.º 2
0
def output_header():
    if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
        base = basedir.get_basedir()
        html_header = __output_html_template__(base + "/html/html.header")
        tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", "/html/jquery.tablesorter.min.js.zip")
        flot_js = __get_zip_file_content__("jquery.flot.js")
        pie_js = __get_zip_file_content__("jquery.flot.pie.js")
        resize_js = __get_zip_file_content__("jquery.flot.resize.js")

        logo_file = open(base + "/html/gitinspector_piclet.png", "rb")
        logo = logo_file.read()
        logo_file.close()
        logo = base64.b64encode(logo)

        if __selected_format__ == "htmlembedded":
            jquery_js = ">" + __get_zip_file_content__("jquery.js")
        else:
            jquery_js = ' src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">'

        print(
            html_header.format(
                title=_("Repository statistics for {0}").format(os.path.basename(basedir.get_basedir_git())),
                jquery=jquery_js,
                jquery_tablesorter=tablesorter_js,
                jquery_flot=flot_js,
                jquery_flot_pie=pie_js,
                jquery_flot_resize=resize_js,
                logo=logo.decode("utf-8", "replace"),
                logo_text=_(
                    "The output has been generated by {0} {1}. The statistical analysis tool" " for git repositories."
                ).format('<a href="http://gitinspector.googlecode.com">gitinspector</a>', version.__version__),
                repo_text=_("Statistical information for the repository '{0}' was gathered on {1}.").format(
                    os.path.basename(basedir.get_basedir_git()), localization.get_date()
                ),
                show_minor_authors=_("Show minor authors"),
                hide_minor_authors=_("Hide minor authors"),
                show_minor_rows=_("Show rows with minor work"),
                hide_minor_rows=_("Hide rows with minor work"),
            )
        )
    elif __selected_format__ == "xml":
        print("<gitinspector>")
        print("\t<version>" + version.__version__ + "</version>")
        print("\t<repository>" + os.path.basename(basedir.get_basedir_git()) + "</repository>")
        print("\t<report-date>" + time.strftime("%Y/%m/%d") + "</report-date>")
    else:
        print(
            textwrap.fill(
                _("Statistical information for the repository '{0}' was gathered on {1}.").format(
                    os.path.basename(basedir.get_basedir_git()), localization.get_date()
                ),
                width=terminal.get_size()[0],
            )
        )
Exemplo n.º 3
0
	def output(self):
		if not self.localize_output:
			localization.disable()

		terminal.skip_escapes(not sys.stdout.isatty())
		terminal.set_stdout_encoding()
		previous_directory = os.getcwd()

		os.chdir(self.repo)
		absolute_path = basedir.get_basedir_git()
		os.chdir(absolute_path)
		format.output_header()
		outputable.output(changes.ChangesOutput(self.hard))

		if changes.get(self.hard).get_commits():
			outputable.output(blame.BlameOutput(changes.get(self.hard), self.hard, self.useweeks))

			if self.timeline:
				outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))

			if self.include_metrics:
				outputable.output(metrics.Metrics())

			if self.responsibilities:
				outputable.output(responsibilities.ResponsibilitiesOutput(self.hard, self.useweeks))

			outputable.output(filtering.Filtering())

			if self.list_file_types:
				outputable.output(extensions.Extensions())

		format.output_footer()
		os.chdir(previous_directory)
Exemplo n.º 4
0
    def output(self):
        terminal.skip_escapes(not sys.stdout.isatty())
        terminal.set_stdout_encoding()
        previous_directory = os.getcwd()

        os.chdir(self.repo)
        absolute_path = basedir.get_basedir_git()
        os.chdir(absolute_path)

        procedure.remove_inspection_branches()
        procedure.create_branches_for_inspection()

        format.output_header()

        sorted_branches = procedure.sort_branches_by_last_update()

        for (commit, branch_name) in sorted_branches:
            if procedure.eligible_for_inspection(commit):
                if procedure.switch_to_branch(branch_name):
                    output = subprocess.Popen(self.command_line, shell=True, bufsize=1, stdout=subprocess.PIPE).stdout
                    print(output.read())
            else:
                print("\n\n ==> All eligible branches have been inspected!")
                break

        procedure.remove_inspection_branches()
        os.chdir(previous_directory)
Exemplo n.º 5
0
	def output(self):
		if not self.localize_output:
			localization.disable()

		terminal.skip_escapes(not sys.stdout.isatty())
		terminal.set_stdout_encoding()
		previous_directory = os.getcwd()

		os.chdir(self.repo)
		absolute_path = basedir.get_basedir_git()
		os.chdir(absolute_path)
		format.output_header()
		outputable.output(changes.ChangesOutput(self.hard))

		if changes.get(self.hard).get_commits():
			outputable.output(blame.BlameOutput(self.hard, self.useweeks))

			if self.timeline:
				outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))

			if self.include_metrics:
				outputable.output(metrics.Metrics())

			if self.responsibilities:
				outputable.output(responsibilities.ResponsibilitiesOutput(self.hard, self.useweeks))

			outputable.output(filtering.Filtering())

			if self.list_file_types:
				outputable.output(extensions.Extensions())

		format.output_footer()
		os.chdir(previous_directory)