Exemple #1
0
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])

    var = __read_git_config_string__(run.repo, "exclude")
    if var[0]:
        filtering.add(var[1])

    var = __read_git_config_string__(run.repo, "format")
    if var[0] and not format.select(var[1]):
        raise format.InvalidFormatError(
            _("specified output format not supported."))

    run.hard = __read_git_config_bool__(run.repo, "hard")
    run.list_file_types = __read_git_config_bool__(run.repo, "list-file-types")
    run.localize_output = __read_git_config_bool__(run.repo, "localize-output")
    run.metrics = __read_git_config_bool__(run.repo, "metrics")
    run.responsibilities = __read_git_config_bool__(run.repo,
                                                    "responsibilities")
    run.useweeks = __read_git_config_bool__(run.repo, "weeks")

    var = __read_git_config_string__(run.repo, "since")
    if var[0]:
        interval.set_since(var[1])

    var = __read_git_config_string__(run.repo, "until")
    if var[0]:
        interval.set_until(var[1])

    run.timeline = __read_git_config_bool__(run.repo, "timeline")

    if __read_git_config_bool__(run.repo, "grading"):
        run.hard = True
        run.list_file_types = True
        run.metrics = True
        run.responsibilities = True
        run.timeline = True
        run.useweeks = True
Exemple #2
0
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])

	var = __read_git_config_string__(run.repo, "exclude")
	if var[0]:
		filtering.add(var[1])

	var = __read_git_config_string__(run.repo, "format")
	if var[0] and not format.select(var[1]):
		raise format.InvalidFormatError(_("specified output format not supported."))

	run.hard = __read_git_config_bool__(run.repo, "hard")
	run.list_file_types = __read_git_config_bool__(run.repo, "list-file-types")
	run.localize_output = __read_git_config_bool__(run.repo, "localize-output")
	run.metrics = __read_git_config_bool__(run.repo, "metrics")
	run.responsibilities = __read_git_config_bool__(run.repo, "responsibilities")
	run.useweeks = __read_git_config_bool__(run.repo, "weeks")

	var = __read_git_config_string__(run.repo, "since")
	if var[0]:
		interval.set_since(var[1])

	var = __read_git_config_string__(run.repo, "until")
	if var[0]:
		interval.set_until(var[1])

	run.timeline = __read_git_config_bool__(run.repo, "timeline")

	if __read_git_config_bool__(run.repo, "grading"):
		run.hard = True
		run.list_file_types = True
		run.metrics = True
		run.responsibilities = True
		run.timeline = True
		run.useweeks = True
def main():
	terminal.check_terminal_encoding()
	terminal.set_stdin_encoding()
	argv = terminal.convert_command_line_to_utf8()
	__run__ = Runner()

	try:
		__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

		#We need the repo above to be set before we read the git config.
		config.init(__run__)
		clear_x_on_next_pass = True

		for o, a in __opts__:
			if o in("-h", "--help"):
				help.output()
				sys.exit(0)
			elif o in("-f", "--file-types"):
				extensions.define(a)
			elif o in("-F", "--format"):
				if not format.select(a):
					raise format.InvalidFormatError(_("specified output format not supported."))
			elif o == "-H":
				__run__.hard = True
			elif o == "--hard":
				__run__.hard = optval.get_boolean_argument(a)
			elif o == "-l":
				__run__.list_file_types = True
			elif o == "--list-file-types":
				__run__.list_file_types = optval.get_boolean_argument(a)
			elif o == "-L":
				__run__.localize_output = True
			elif o == "--localize-output":
				__run__.localize_output = optval.get_boolean_argument(a)
			elif o == "-m":
				__run__.include_metrics = True
			elif o == "--metrics":
				__run__.include_metrics = optval.get_boolean_argument(a)
			elif o == "-r":
				__run__.responsibilities = True
			elif o == "--responsibilities":
				__run__.responsibilities = optval.get_boolean_argument(a)
			elif o == "--since":
				interval.set_since(a)
			elif o == "--version":
				version.output()
				sys.exit(0)
			elif o == "--grading":
				grading = optval.get_boolean_argument(a)
				__run__.include_metrics = grading
				__run__.list_file_types = grading
				__run__.responsibilities = grading
				__run__.grading = grading
				__run__.hard = grading
				__run__.timeline = grading
				__run__.useweeks = grading
			elif o == "-T":
				__run__.timeline = True
			elif o == "--timeline":
				__run__.timeline = optval.get_boolean_argument(a)
			elif o == "--until":
				interval.set_until(a)
			elif o == "-w":
				__run__.useweeks = True
			elif o == "--weeks":
				__run__.useweeks = optval.get_boolean_argument(a)
			elif o in("-x", "--exclude"):
				if clear_x_on_next_pass:
					clear_x_on_next_pass = False
					filtering.clear()
				filtering.add(a)

		__check_python_version__()
		__run__.output()

	except (filtering.InvalidRegExpError, format.InvalidFormatError, optval.InvalidOptionArgument, getopt.error) as exception:
		print(sys.argv[0], "\b:", exception.msg, file=sys.stderr)
		print(_("Try `{0} --help' for more information.").format(sys.argv[0]), file=sys.stderr)
		sys.exit(2)
Exemple #4
0
def main():
    terminal.check_terminal_encoding()
    terminal.set_stdin_encoding()
    argv = terminal.convert_command_line_to_utf8()
    __run__ = Runner()

    try:
        __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

        #Try to clone the repo or return the same directory and bail out.
        __run__.repo = clone.create(__run__.repo)

        #We need the repo above to be set before we read the git config.
        config.init(__run__)
        clear_x_on_next_pass = True

        for o, a in __opts__:
            if o in ("-h", "--help"):
                help.output()
                sys.exit(0)
            elif o in ("-f", "--file-types"):
                extensions.define(a)
            elif o in ("-F", "--format"):
                if not format.select(a):
                    raise format.InvalidFormatError(
                        _("specified output format not supported."))
            elif o == "-H":
                __run__.hard = True
            elif o == "--hard":
                __run__.hard = optval.get_boolean_argument(a)
            elif o == "-l":
                __run__.list_file_types = True
            elif o == "--list-file-types":
                __run__.list_file_types = optval.get_boolean_argument(a)
            elif o == "-L":
                __run__.localize_output = True
            elif o == "--localize-output":
                __run__.localize_output = optval.get_boolean_argument(a)
            elif o == "-m":
                __run__.include_metrics = True
            elif o == "--metrics":
                __run__.include_metrics = optval.get_boolean_argument(a)
            elif o == "-r":
                __run__.responsibilities = True
            elif o == "--responsibilities":
                __run__.responsibilities = optval.get_boolean_argument(a)
            elif o == "--since":
                interval.set_since(a)
            elif o == "--version":
                version.output()
                sys.exit(0)
            elif o == "--grading":
                grading = optval.get_boolean_argument(a)
                __run__.include_metrics = grading
                __run__.list_file_types = grading
                __run__.responsibilities = grading
                __run__.grading = grading
                __run__.hard = grading
                __run__.timeline = grading
                __run__.useweeks = grading
            elif o == "-T":
                __run__.timeline = True
            elif o == "--timeline":
                __run__.timeline = optval.get_boolean_argument(a)
            elif o == "--until":
                interval.set_until(a)
            elif o == "-w":
                __run__.useweeks = True
            elif o == "--weeks":
                __run__.useweeks = optval.get_boolean_argument(a)
            elif o in ("-x", "--exclude"):
                if clear_x_on_next_pass:
                    clear_x_on_next_pass = False
                    filtering.clear()
                filtering.add(a)

        __check_python_version__()
        __run__.output()

    except (filtering.InvalidRegExpError, format.InvalidFormatError,
            optval.InvalidOptionArgument, getopt.error) as exception:
        print(sys.argv[0], "\b:", exception.msg, file=sys.stderr)
        print(_("Try `{0} --help' for more information.").format(sys.argv[0]),
              file=sys.stderr)
        sys.exit(2)
            elif o in ("--since"):
                interval.set_since(a)
            elif o in ("--version"):
                version.output()
                sys.exit(0)
            elif o in ("--grading"):
                __run__.include_metrics = True
                __run__.list_file_types = True
                __run__.responsibilities = True
                __run__.grading = True
                __run__.hard = True
                __run__.timeline = True
                __run__.useweeks = True
            elif o in ("-T", "--timeline"):
                __run__.timeline = True
            elif o in ("--until"):
                interval.set_until(a)
            elif o in ("-w"):
                __run__.useweeks = True
            elif o in ("-x", "--exclude"):
                filtering.add(a)
        for arg in __args__:
            __run__.repo = arg

    except (format.InvalidFormatError, getopt.error) as msg:
        print(sys.argv[0], "\b:", msg)
        print("Try `", sys.argv[0], "--help' for more information.")
        sys.exit(2)

    __run__.output()