Exemple #1
0
def blame(filename, args):
    repo, uri, out, opts = args
    filename = filename.strip(" \n")

    if filename[-1] == "/":
        return

    p = create_parser(repo.get_type(), filename)
    p.set_output_device(out)

    def feed(line, p):
        p.feed(line)

    wid = repo.add_watch(BLAME, feed, p)
    try:
        repo.blame(os.path.join(uri, filename), rev=opts.revision, mc=not opts.fast)
    except RepositoryCommandError, e:
        printerr("Error getting blame information of path '%s': %s", (filename, e.error))
Exemple #2
0
            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)
    else:
        uri = uri.strip("/")
        repo = create_repository("svn", uri)
        # Check uri actually points to a valid svn repo
        if repo.get_last_revision(uri) is None:
            printerr("URI %s doesn't seem to point to a valid svn repository", (uri,))
            return 1

    # Check we have a parser for the given repo
    try:
        p = create_parser(repo.get_type(), "foo")
    except ParserUnknownError:
        printerr("%s repositories are not supported by guilty (yet)", (repo.get_type(),))
        return 1
    except Exception, e:
        printerr("Unknown error creating parser for repository %s (%s)", (repo.get_uri(), str(e)))
        return 1
    del p

    try:
        out = create_output_device(config.output)
    except OutputDeviceUnknownError:
        printerr("Output type %s is not supported by guilty", (config.output,))
        return 1
    except OutputDeviceError, e:
        printerr(str(e))