Opened 18 years ago
Last modified 6 years ago
#3906 new enhancement
Request for a files search (no indexing just plain find like search)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | version control/browser | Version: | 0.10 |
Severity: | normal | Keywords: | bitesized |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I would like a /usr/bin/find like file search to look for a specific filename in the repository recursively (ie, some*.pdf)
I've seen the RepoSearch hack but I would like a simple file search (perhaps in Browse source or in Search directly with a files checkbox) that would let me search for a file or files in particular strictly based on the files in the repository.
This is a simple feature, I'm surprised it hasn't been implemented yet ;)
perhaps a simple hack would be in order…
Attachments (0)
Change History (10)
follow-up: 10 comment:1 by , 18 years ago
Milestone: | → 0.11 |
---|
comment:2 by , 18 years ago
Sweet :)
Your right, it's probably not that simple to implement…
Thanks for the hard work! TRAC ROCK!!
follow-up: 8 comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is now implemented in the Filename Search plugin.
comment:5 by , 15 years ago
Keywords: | bitesized added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Would be nice to get this to work in a backend neutral way, as outlined in comment:1.
The filter itself could eventually be a tracopt.
component but there will also probably be trac.versioncontrol.api
changes that need to be done.
Nice bitesized feature for an upcoming release.
comment:6 by , 14 years ago
Milestone: | → next-major-0.1X |
---|
comment:7 by , 9 years ago
Owner: | removed |
---|---|
Status: | reopened → new |
follow-up: 9 comment:8 by , 6 years ago
This is now implemented in the Filename Search plugin.
This was deleted.
comment:9 by , 6 years ago
Replying to anonymous:
This is now implemented in the Filename Search plugin.
This was deleted.
I'm not sure reason of the removal but it is able to export by giving revision number.
$ svn export https://trac-hacks.org/svn/filenamesearchplugin/0.10@13221 filenamesearchplugin
Also, the plugin supports only default repository.
comment:10 by , 6 years ago
Replying to Christian Boos:
in Mercurial for example, you could simply search through the latest "manifest" (i.e. the list of all files).
Proof-of-concept seems to work well:
from trac.core import Component, implements from trac.search import ISearchSource from trac.resource import Resource from trac.versioncontrol.api import RepositoryManager class MercurialFilenameSearch(Component): """Search Mercurial filenames.""" implements(ISearchSource) def get_search_filters(self, req): if 'FILE_VIEW' in req.perm: yield ('hgfilenames', 'Mercurial Filenames', False) def get_search_results(self, req, terms, filters): if not 'hgfilenames' in filters: return rm = RepositoryManager(self.env) for repos in rm.get_real_repositories(): if repos.params.get('type') != 'hg': continue root = repos.get_node('/') for raw_filename in root.manifest: filename = repos.to_u(raw_filename) if not all(term in filename for term in terms): continue node = repos.get_node(filename) changeset = repos.get_changeset(node.created_rev) resource = Resource(node.realm, node.path, parent=repos.resource) if 'FILE_VIEW' not in req.perm(resource): continue url = rm.get_resource_url(resource, req.href) author = changeset.author date = changeset.date summary = rm.get_resource_description(resource, 'summary') yield url, summary, date, author, ''
Replying to sineer@gmail.com:
Perhaps because it's simpler to describe than to implement ;)
Looking in all files in the repository is out of question, as this would imply going recursively in the tree, which in case of Subversion is always something huge (due to the tag/branch by copying principle).
So we'd have to use the database, and the
node_change
table. There, it's a bit better, as we will get the filenames, but we'd have to sort through the revisions to get the latest one (or the previous to last, in case the last is a Delete!). And that's not easily done for all backends, at least for now. See also #3837.On the other hand, in Mercurial for example, you could simply search through the latest "manifest" (i.e. the list of all files).
But yes, it's a good idea.