#!/usr/bin/env python
"""
wciia - Whose Code Is It Anyway
Determines code owner of the file/folder relative to the llvm source root.
Code owner is determined from the content of the CODE_OWNERS.TXT
by parsing the D: field
usage:
utils/wciia.py path
limitations:
- must be run from llvm source root
- very simplistic algorithm
- only handles * as a wildcard
- not very user friendly
- does not handle the proposed F: field
"""
=
=
# paths must be in ( ... ) so strip them
=
=
# give up
return
=
# split paths
=
=
# print "F: field missing, using D: field"
=
=
# process CODE_OWNERS.TXT first
=
=
=
=
# reset the values
=
=
=
=
=
=
=
= -1
# very simplistic way of findning the best match
=
# print "searching (" + path + ")"
# try exact match
return
# see if path ends with a *
=
# try the longest match,
= -1
=
return
# now lest try to find the owner of the file or folder
# the path we are checking
=
# check if this is real path
=
# be grammatically correct
# bottom up walk of the current .
# not yet used
=