if bug_fix_regexes == ['']: # This is empty, it means the user didn't want to match bug_fix_regexes_case_sensitive = [] config.bug_fix_regexes_case_sensitive = \ bug_fix_regexes_case_sensitive if not config.extensions and config.no_parse: # Do nothing!!! return 0 if config.debug: import repositoryhandler repositoryhandler.backends.DEBUG = True path = uri_to_filename(uri) (uri, repo) = _get_uri_and_repo(path) if not config.no_parse: printdbg("Preparing logging") # Create reader reader = LogReader() reader.set_repo(repo, path or uri) reader.set_branch(config.branch) # Create parser if config.repo_logfile is not None: parser = create_parser_from_logfile(config.repo_logfile) reader.set_logfile(config.repo_logfile) else: parser = _get_parser_from_repository(repo)
self.fd.write(self.buffer) self.fd.close() if __name__ == '__main__': import sys import os from utils import uri_to_filename from repositoryhandler.backends import create_repository, create_repository_from_path def new_line(line, user_data=None): print line.strip('\n') if user_data is not None: user_data.add_line(line) path = uri_to_filename(sys.argv[1]) if path is not None: repo = create_repository_from_path(path) else: repo = create_repository('svn', sys.argv[1]) path = sys.argv[1] reader = LogReader() reader.set_repo(repo, path) writer = None if len(sys.argv) > 2: if os.path.isfile(sys.argv[2]): reader.set_logfile(sys.argv[2]) else:
def main(args): parser = OptionParser(usage='%prog [ options ... ] URI [ FILES ]', description='Analyze repository modifications', version=VERSION) parser.disable_interspersed_args() parser.add_option('-g', '--debug', dest='debug', action="store_true", default=False, help="Run in debug mode") parser.add_option('-c', '--config-file', dest='config_file', metavar='FILE', help="Use a custom configuration file") parser.add_option('-r', '--revision', dest='revision', metavar='REV', help='Revision to analyze (HEAD)') parser.add_option('-f', '--fast', dest='fast', action="store_true", default=False, help="Run faster but moves and copies are not detected") parser.add_option('-o', '--output', dest='output', default='text', help='Output type [text|db|xml|csv] (%default)') add_outputs_options(parser) # Save default values and pass an emtpy Values object to # parser_args, so that default values are not set. We need it # to know whether a value has been provided by the user or not # After parsing the command line we complete the config options # with the default values for the options that have not been set # by the parser or by a config file defaults = parser.get_default_values() options, args = parser.parse_args(args, values=Values()) try: config = Config(options.config_file) except AttributeError: config = Config() config.update(options.__dict__) config.add(defaults.__dict__) if not args: parser.error("missing required repository URI") return 1 parser.destroy() if config.debug: import repositoryhandler.backends repositoryhandler.backends.DEBUG = True uri = args[0] files = args[1:] files_from_stdin = (files and files[0] == '-') # Create repository path = uri_to_filename(uri) if path is not None: try: repo = create_repository_from_path(path) except RepositoryUnknownError: printerr( "Path %s doesn't seem to point to a repository supported by guilty", (path, )) return 1 except Exception, e: printerr("Unknown error creating repository for path %s (%s)", (path, str(e))) return 1 uri = repo.get_uri_for_path(path)
def main (args): parser = OptionParser (usage='%prog [ options ... ] URI [ FILES ]', description='Analyze repository modifications', version=VERSION) parser.disable_interspersed_args() parser.add_option ('-g', '--debug', dest='debug', action="store_true", default=False, help="Run in debug mode") parser.add_option ('-c', '--config-file', dest='config_file', metavar='FILE', help="Use a custom configuration file") parser.add_option ('-r', '--revision', dest='revision', metavar='REV', help='Revision to analyze (HEAD)') parser.add_option ('-f', '--fast', dest='fast', action="store_true", default=False, help="Run faster but moves and copies are not detected") parser.add_option ('-o', '--output', dest='output', default = 'text', help='Output type [text|db|xml|csv] (%default)') add_outputs_options (parser) # Save default values and pass an emtpy Values object to # parser_args, so that default values are not set. We need it # to know whether a value has been provided by the user or not # After parsing the command line we complete the config options # with the default values for the options that have not been set # by the parser or by a config file defaults = parser.get_default_values () options, args = parser.parse_args (args, values = Values()) try: config = Config (options.config_file) except AttributeError: config = Config () config.update (options.__dict__) config.add (defaults.__dict__) if not args: parser.error("missing required repository URI") return 1 parser.destroy () if config.debug: import repositoryhandler.backends repositoryhandler.backends.DEBUG = True uri = args[0] files = args[1:] files_from_stdin = (files and files[0] == '-') # Create repository path = uri_to_filename (uri) if path is not None: try: repo = create_repository_from_path (path) except RepositoryUnknownError: printerr ("Path %s doesn't seem to point to a repository supported by guilty", (path,)) return 1 except Exception, e: printerr ("Unknown error creating repository for path %s (%s)", (path, str (e))) return 1 uri = repo.get_uri_for_path (path)