def auto_add(repo, autooptions, files):
<EOL>mapping = { "<STR_LIT:.>": "<STR_LIT>" }<EOL>if (('<STR_LIT>' in autooptions) and<EOL>('<STR_LIT>' in autooptions['<STR_LIT>'])):<EOL><INDENT>mapping = autooptions['<STR_LIT>']['<STR_LIT>']<EOL><DEDENT>keys = mapping.keys()<EOL>keys = sorted(keys, key=lambda k: len(k), reverse=True)<EOL>count = <NUM_LIT:0><EOL>params = []<EOL>for f in files:<EOL><INDENT>relativepath = f<EOL>for k in keys:<EOL><INDENT>v = mapping[k]<EOL>if f.startswith(k + "<STR_LIT:/>"):<EOL><INDENT>relativepath = f.replace(k + "<STR_LIT:/>", v)<EOL>break<EOL><DEDENT><DEDENT>count += files_add(repo=repo,<EOL>args=[f],<EOL>targetdir=os.path.dirname(relativepath))<EOL><DEDENT>return count<EOL>
Cleanup the paths and add