Example #1
0
    def _get_dirindex(path_dirindex_conf, path_rootfs):
        paths = dirindex.read_paths(file(path_dirindex_conf))
        paths = [ re.sub(r'^(-?)', '\\1' + path_rootfs, path) 
                  for path in paths ]

        tmp = TempFile()
        dirindex.create(tmp.path, paths)

        filtered = [ re.sub(r'^' + path_rootfs, '', line) 
                            for line in file(tmp.path).readlines() ]
        return "".join(filtered)
    def _get_dirindex(path_dirindex_conf, path_rootfs):
        paths = dirindex.read_paths(file(path_dirindex_conf))
        paths = [re.sub(r'^(-?)', '\\1' + path_rootfs, path) for path in paths]

        tmp = TempFile()
        dirindex.create(tmp.path, paths)

        filtered = [
            re.sub(r'^' + path_rootfs, '', line)
            for line in file(tmp.path).readlines()
        ]
        return "".join(filtered)
Example #3
0
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        elif opt in ('-c', '--create'):
            opt_create = True

        elif opt in ('-i', '--input'):
            opt_input = val

    if not args or (not opt_input and len(args) < 2):
        usage()

    path_index = args[0]
    paths = args[1:]

    if opt_input:
        fh = file(opt_input) if opt_input != '-' else sys.stdin
        paths = dirindex.read_paths(fh) + paths

    if opt_create:
        dirindex.create(path_index, paths)
        return

    for change in changes.whatchanged(path_index, paths):
        print change


if __name__ == "__main__":
    main()
Example #4
0
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        elif opt in ('-c', '--create'):
            opt_create = True

        elif opt in ('-i', '--input'):
            opt_input = val

    if not args or (not opt_input and len(args) < 2):
        usage()

    path_index = args[0]
    paths = args[1:]
    
    if opt_input:
        fh = file(opt_input) if opt_input != '-' else sys.stdin
        paths = dirindex.read_paths(fh) + paths

    if opt_create:
        dirindex.create(path_index, paths)
        return

    for change in changes.whatchanged(path_index, paths):
        print change

if __name__=="__main__":
    main()