https://github.com/blog/793-introducing-the-file-finder
I have currently started to implement this by searching for blobs in the root tree with matching file names. This can be extended by searching the child trees to a certain depth to find the file. This is in the patch attached below.
So yesterday, I was looking to further implement this patch on the internet and was able to read the documentation of git python to use the git ls-files command and found this http://gitpython.readthedocs.io/en/stable/reference.html#git.cmd.Git
But i'm not sure if this is the way to go about it since this will be limited to git repositories and I guess the previous method will be useful for all SCM repos.
Also, I'm thinking that we should just expose this function via REST and use JS to display the search results instead on demand.
Would like to know suggestions on how to further go about this.
Diff:
In general we have been slowly working to use repo commands directly (like git ls-files) and implement each variation (git, hg, svn) rather than relying indexing of data into mongo (like the blob objects). Some simple caching in mongo might still be necessary though. More info at https://forge-allura.apache.org/p/allura/wiki/Goals/#make-githgsvn-repositories-indexless
But since the blob data is already there, that is of course is going to be a lot easier than implementing direct access (like git python
ls-files
command, and svn and hg too). So I would suggest adding anall_files
method toRepositoryImplementation
which uses the blobs for now. And then later if we want to change it we can just change theall_files
implementation (and not have to modify the file search code)Doing it via REST and JS makes a lot of sense to me. Instead of doing the search on the server, what if the rest api returned all the files in the repo, and the JS filtered through them? Then the JS would be able to show partial matches and autocomplete and things like that if we wanted.
Last edit: Dave Brondsema 2016-07-12