fixes #681
This commit is contained in:
@@ -905,10 +905,15 @@ Finds the installed package which contains the specified file.
|
|||||||
default=False, help="show in long format")
|
default=False, help="show in long format")
|
||||||
|
|
||||||
def search_exact(path):
|
def search_exact(path):
|
||||||
|
import os.path
|
||||||
|
|
||||||
path = path.lstrip('/') #FIXME: this shouldn't be necessary :/
|
path = path.lstrip('/') #FIXME: this shouldn't be necessary :/
|
||||||
if ctx.filesdb.has_file(path):
|
files = ctx.filesdb.get_files(path)
|
||||||
(pkg_name, file_info) = ctx.filesdb.get_file(path)
|
|
||||||
ctx.ui.info(_('Package: %s') % pkg_name)
|
if files:
|
||||||
|
for (pkg_name, file_info) in files:
|
||||||
|
#FIXME: there can be a prettier info line
|
||||||
|
ctx.ui.info(_('Package: %s has File: %s') % (pkg_name, file_info.path))
|
||||||
if ctx.config.options.long:
|
if ctx.config.options.long:
|
||||||
ctx.ui.info(_('Type: %s, Hash: %s') % (file_info.type,
|
ctx.ui.info(_('Type: %s, Hash: %s') % (file_info.type,
|
||||||
file_info.hash) )
|
file_info.hash) )
|
||||||
|
|||||||
@@ -67,3 +67,13 @@ class FilesDB(shelve.LockedDBShelf):
|
|||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return self[path]
|
return self[path]
|
||||||
|
|
||||||
|
def get_files(self, file):
|
||||||
|
infos = []
|
||||||
|
file = str(file)
|
||||||
|
|
||||||
|
for key in self.keys():
|
||||||
|
if key.find(file) >= 0:
|
||||||
|
infos.append(self[key])
|
||||||
|
|
||||||
|
return infos
|
||||||
|
|||||||
Reference in New Issue
Block a user