Ejemplo n.º 1
0
	def __output_text_section__(info_string, filtered):
		if filtered:
			print("\n" + textwrap.fill(info_string + ":", width=terminal.get_size()[0]))

			for i in filtered:
				(width, _unused) = terminal.get_size()
				print("...%s" % i[-width+3:] if len(i) > width else i)
    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, _) = terminal.get_size()
                print("...%s" % missing[-width + 3 :] if len(missing) > width else missing)
	def output_text(self):
		if __filtered_files__:
			print("\n" + textwrap.fill(__filtering_info_text__ + ":", width=terminal.get_size()[0]))

			for i in __filtered_files__:
				(width, _) = terminal.get_size()
				print("...%s" % i[-width+3:] if len(i) > width else i)
Ejemplo n.º 4
0
	def output_text(self):
		if __filtered_files__:
			print("\n" + textwrap.fill(_(FILTERING_INFO_TEXT) + ":", width=terminal.get_size()[0]))

			for i in __filtered_files__:
				(width, _unused) = terminal.get_size()
				print("...%s" % i[-width+3:] if len(i) > width else i)
Ejemplo n.º 5
0
	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)
Ejemplo n.º 6
0
	def __output_text_section__(info_string, filtered):
		if filtered:
			print("\n" + textwrap.fill(info_string + ":", width=terminal.get_size()[0]))

			for i in filtered:
				(width, _unused) = terminal.get_size()
				print("...%s" % i[-width+3:] if len(i) > width else i)
Ejemplo n.º 7
0
    def output_text(self):
        if __filtered_files__:
            print("\n" + textwrap.fill(__filtering_info_text__ + ":",
                                       width=terminal.get_size()[0]))

            for i in __filtered_files__:
                (width, _) = terminal.get_size()
                print("...%s" % i[-width + 3:] if len(i) > width else i)
Ejemplo n.º 8
0
    def output_text(self):
        if __filtered_files__:
            print("\n" + textwrap.fill(_(FILTERING_INFO_TEXT) + ":",
                                       width=terminal.get_size()[0]))

            for i in __filtered_files__:
                (width, _unused) = terminal.get_size()
                print("...%s" % i[-width + 3:] if len(i) > width else i)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
    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, _) = terminal.get_size()
                print("...%s" %
                      missing[-width +
                              3:] if len(missing) > width else missing)
Ejemplo n.º 11
0
	def output_text(self):
		if self.changes.get_commits():
			print("\n" + textwrap.fill(_(TIMELINE_INFO_TEXT) + ":", width=terminal.get_size()[0]))

			timeline_data = TimelineData(self.changes, self.useweeks)
			periods = timeline_data.get_periods()
			names = timeline_data.get_authors()
			(width, _unused) = terminal.get_size()
			max_periods_per_row = int((width - 21) / 11)

			for i in range(0, len(periods), max_periods_per_row):
				__output_row__text__(timeline_data, periods[i:i+max_periods_per_row], names)
Ejemplo n.º 12
0
	def output_text(self):
		if self.changes.get_commits():
			print("\n" + textwrap.fill(_(TIMELINE_INFO_TEXT) + ":", width=terminal.get_size()[0]))

			timeline_data = TimelineData(self.changes, self.useweeks)
			periods = timeline_data.get_periods()
			names = timeline_data.get_authors()
			(width, _unused) = terminal.get_size()
			max_periods_per_row = int((width - 21) / 11)

			for i in range(0, len(periods), max_periods_per_row):
				__output_row__text__(timeline_data, periods[i:i+max_periods_per_row], names)
Ejemplo n.º 13
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]))
Ejemplo n.º 14
0
    def output_text(self):
        authorinfo_list = self.changes.get_authorinfo_list()
        total_changes = 0.0

        for i in authorinfo_list:
            total_changes += authorinfo_list.get(i).insertions
            total_changes += authorinfo_list.get(i).deletions

        if authorinfo_list:
            print(
                textwrap.fill(_(HISTORICAL_INFO_TEXT) + ":",
                              width=terminal.get_size()[0]) + "\n")
            terminal.printb(
                _("Author").ljust(21) + _("Commits").rjust(13) +
                _("Insertions").rjust(14) + _("Deletions").rjust(15) +
                _("% of changes").rjust(16))

            for i in sorted(authorinfo_list):
                authorinfo = authorinfo_list.get(i)
                percentage = 0 if total_changes == 0 else (
                    authorinfo.insertions +
                    authorinfo.deletions) / total_changes * 100

                print(i.ljust(20)[0:20], end=" ")
                print(str(authorinfo.commits).rjust(13), end=" ")
                print(str(authorinfo.insertions).rjust(13), end=" ")
                print(str(authorinfo.deletions).rjust(14), end=" ")
                print("{0:.2f}".format(percentage).rjust(15))
        else:
            print(_(NO_COMMITED_FILES_TEXT) + ".")
Ejemplo n.º 15
0
	def output_text(self):
		authorinfo_list = self.changes.get_authorinfo_list()
		total_changes = 0.0

		for i in authorinfo_list:
			total_changes += authorinfo_list.get(i).insertions
			total_changes += authorinfo_list.get(i).deletions

		if authorinfo_list:
			print(textwrap.fill(_(HISTORICAL_INFO_TEXT) + ":", width=terminal.get_size()[0]) + "\n")
			terminal.printb(terminal.ljust(_("Author"), 21) + terminal.rjust(_("Commits"), 13) +
			                terminal.rjust(_("Insertions"), 14) + terminal.rjust(_("Deletions"), 15) +
					terminal.rjust(_("% of changes"), 16))

			for i in sorted(authorinfo_list):
				authorinfo = authorinfo_list.get(i)
				percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100

				print(terminal.ljust(i, 20)[0:20 - terminal.get_excess_column_count(i)], end=" ")
				print(str(authorinfo.commits).rjust(13), end=" ")
				print(str(authorinfo.insertions).rjust(13), end=" ")
				print(str(authorinfo.deletions).rjust(14), end=" ")
				print("{0:.2f}".format(percentage).rjust(15))
		else:
			print(_(NO_COMMITED_FILES_TEXT) + ".")
Ejemplo n.º 16
0
    def output_text(self):
        authorinfo_list = get(self.hard).get_authorinfo_list()
        total_changes = 0.0

        for i in authorinfo_list:
            total_changes += authorinfo_list.get(i).insertions
            total_changes += authorinfo_list.get(i).deletions

        if authorinfo_list:
            print(
                textwrap.fill(__historical_info_text__ + ":",
                              width=terminal.get_size()[0]) + "\n")
            terminal.printb("Author".ljust(21) + "Commits   " +
                            "Insertions   " + "Deletions   " + "% of changes")

            for i in sorted(authorinfo_list):
                authorinfo = authorinfo_list.get(i)
                percentage = 0 if total_changes == 0 else (
                    authorinfo.insertions +
                    authorinfo.deletions) / total_changes * 100

                print(i.ljust(20)[0:20], end=" ")
                print(str(authorinfo.commits).rjust(7), end=" ")
                print(str(authorinfo.insertions).rjust(12), end=" ")
                print(str(authorinfo.deletions).rjust(11), end=" ")
                print("{0:.2f}".format(percentage).rjust(14))
        else:
            print(__no_commited_files__ + ".")
Ejemplo n.º 17
0
	def output_text(self):
		print("\n" + textwrap.fill(_(RESPONSIBILITIES_INFO_TEXT) + ":", width=terminal.get_size()[0]))

		for i in sorted(set(i[0] for i in blame.get(self.hard, self.useweeks, self.changes).blames)):
			responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, self.useweeks, i)), reverse=True)
			if responsibilities:
				print("\n" + i, _(MOSTLY_RESPONSIBLE_FOR_TEXT) + ":")

				for j, entry in enumerate(responsibilities):
					(width, _unused) = terminal.get_size()
					width -= 7

					print(str(entry[0]).rjust(6), end=" ")
					print("...%s" % entry[1][-width+3:] if len(entry[1]) > width else entry[1])

					if j >= 9:
						break
	def output_text(self):
		print("\n" + textwrap.fill(__responsibilities_info_text__ + ":", width=terminal.get_size()[0]))

		for i in sorted(set(i[0] for i in blame.get(self.hard).blames)):
			responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True)
			if responsibilities:
				print("\n" + i, "is mostly responsible for:")

				for j, entry in enumerate(responsibilities):
					(width, _) = terminal.get_size()
					width -= 7

					print(str(entry[0]).rjust(6), end=" ")
					print("...%s" % entry[1][-width+3:] if len(entry[1]) > width else entry[1])

					if j >= 9:
						break
Ejemplo n.º 19
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],
            )
        )
Ejemplo n.º 20
0
    def output_text(self):
        if __located_extensions__:
            print("\n" + textwrap.fill("{0} {1}:".format(_(EXTENSIONS_INFO_TEXT), _(EXTENSIONS_MARKED_TEXT)),
                                       width=terminal.get_size()[0]))

            for i in __located_extensions__:
                if i in __extensions__:
                    print("[" + terminal.__bold__ + i + terminal.__normal__ + "]", end=" ")
                else:
                    print(i, end=" ")
            print("")
Ejemplo n.º 21
0
	def output_text(self):
		if sys.stdout.isatty() and format.is_interactive_format():
			terminal.clear_row()

		print(textwrap.fill(_(BLAME_INFO_TEXT) + ":", width=terminal.get_size()[0]) + "\n")
		terminal.printb(_("Author").ljust(21) + _("Rows").rjust(10) + _("% in comments").rjust(20))

		for i in sorted(__blame__.get_summed_blames().items()):
			print(i[0].ljust(20)[0:20], end=" ")
			print(str(i[1].rows).rjust(10), end=" ")
			print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(19))
Ejemplo n.º 22
0
def output(changes, useweeks):
	if changes.get_commits():
		print "\nThe following history timeline has been gathered from the repository:"

		timeline_data = TimelineData(changes, useweeks)
		periods = timeline_data.get_periods()
		names = timeline_data.get_authors()
		(width, _) = terminal.get_size()
		max_periods_per_row = (width - 21) / 11

		for i in range(0, len(periods), max_periods_per_row):
			__output_row__(changes, timeline_data, periods[i:i+max_periods_per_row], names)
Ejemplo n.º 23
0
	def output_text(self):
		print("")
		get(self.hard)

		if self.hard and sys.stdout.isatty():
			terminal.clear_row()

		print(textwrap.fill(__blame_info_text__ + ":", width=terminal.get_size()[0]) + "\n")
		terminal.printb("Author".ljust(21) + "Rows".rjust(10) + "% in comments".rjust(16))
		for i in sorted(__blame__.get_summed_blames().items()):
			print(i[0].ljust(20)[0:20], end=" ")
			print(str(i[1].rows).rjust(10), end=" ")
			print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(15))
Ejemplo n.º 24
0
def output(changes, useweeks):
    if changes.get_commits():
        print "\nThe following history timeline has been gathered from the repository:"

        timeline_data = TimelineData(changes, useweeks)
        periods = timeline_data.get_periods()
        names = timeline_data.get_authors()
        (width, _) = terminal.get_size()
        max_periods_per_row = (width - 21) / 11

        for i in range(0, len(periods), max_periods_per_row):
            __output_row__(changes, timeline_data,
                           periods[i:i + max_periods_per_row], names)
Ejemplo n.º 25
0
	def output_text(self):
		if sys.stdout.isatty() and format.is_interactive_format():
			terminal.clear_row()

		print(textwrap.fill(_(BLAME_INFO_TEXT) + ":", width=terminal.get_size()[0]) + "\n")
		terminal.printb(terminal.ljust(_("Author"), 21) + terminal.rjust(_("Rows"), 10) + terminal.rjust(_("Stability"), 15) +
		                terminal.rjust(_("Age"), 13) + terminal.rjust(_("% in comments"), 20))

		for i in sorted(__blame__.get_summed_blames().items()):
			print(terminal.ljust(i[0], 20)[0:20 - terminal.get_excess_column_count(i[0])], end=" ")
			print(str(i[1].rows).rjust(10), end=" ")
			print("{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)).rjust(14), end=" ")
			print("{0:.1f}".format(float(i[1].skew) / i[1].rows).rjust(12), end=" ")
			print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(19))
Ejemplo n.º 26
0
	def output_text(self):
		if sys.stdout.isatty() and format.is_interactive_format():
			terminal.clear_row()

		print(textwrap.fill(_(BLAME_INFO_TEXT) + ":", width=terminal.get_size()[0]) + "\n")
		terminal.printb(terminal.ljust(_("Author"), 21) + terminal.rjust(_("Rows"), 10) + terminal.rjust(_("Stability"), 15) +
		                terminal.rjust(_("Age"), 13) + terminal.rjust(_("% in comments"), 20))

		for i in sorted(__blame__.get_summed_blames().items()):
			print(terminal.ljust(i[0], 20)[0:20 - terminal.get_excess_column_count(i[0])], end=" ")
			print(str(i[1].rows).rjust(10), end=" ")
			print("{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)).rjust(14), end=" ")
			print("{0:.1f}".format(float(i[1].skew) / i[1].rows).rjust(12), end=" ")
			print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(19))
Ejemplo n.º 27
0
    def output_text(self):
        if __located_extensions__:
            print("\n" + textwrap.fill("{0} {1}:".format(
                _(EXTENSIONS_INFO_TEXT), _(EXTENSIONS_MARKED_TEXT)),
                                       width=terminal.get_size()[0]))

            for i in __located_extensions__:
                if i in __extensions__:
                    print("[" + terminal.__bold__ + i + terminal.__normal__ +
                          "]",
                          end=" ")
                else:
                    print(i, end=" ")
            print("")
    def output_text(self):
        if __located_extensions__:
            print("\n" + textwrap.fill(
                __extensions_info_text__ +
                "\n(extensions used during statistical analysis are marked):",
                width=terminal.get_size()[0]))

            for i in __located_extensions__:
                if i in __extensions__:
                    print("[" + terminal.__bold__ + i + terminal.__normal__ +
                          "]",
                          end=" ")
                else:
                    print(i, end=" ")
            print("")
Ejemplo n.º 29
0
    def output_text(self):
        if sys.stdout.isatty() and format.is_interactive_format():
            terminal.clear_row()

        print(
            textwrap.fill(_(BLAME_INFO_TEXT) + ":",
                          width=terminal.get_size()[0]) + "\n")
        terminal.printb(
            _("Author").ljust(21) + _("Rows").rjust(10) +
            _("% in comments").rjust(20))

        for i in sorted(__blame__.get_summed_blames().items()):
            print(i[0].ljust(20)[0:20], end=" ")
            print(str(i[1].rows).rjust(10), end=" ")
            print("{0:.2f}".format(100.0 * i[1].comments /
                                   i[1].rows).rjust(19))
	def output_text(self):
		authorinfo_list = get(self.hard).get_authorinfo_list()
		total_changes = 0.0

		for i in authorinfo_list:
			total_changes += authorinfo_list.get(i).insertions
			total_changes += authorinfo_list.get(i).deletions

		if authorinfo_list:
			print(textwrap.fill(__historical_info_text__ + ":", width=terminal.get_size()[0]) + "\n")
			terminal.printb("Author".ljust(21) + "Commits   " + "Insertions   " + "Deletions   " + "% of changes")

			for i in sorted(authorinfo_list):
				authorinfo = authorinfo_list.get(i)
				percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100

				print(i.ljust(20)[0:20], end=" ")
				print(str(authorinfo.commits).rjust(7), end=" ")
				print(str(authorinfo.insertions).rjust(12), end=" ")
				print(str(authorinfo.deletions).rjust(11), end=" ")
				print("{0:.2f}".format(percentage).rjust(14))
		else:
			print(__no_commited_files__ + ".")