The list_directory(path) method in the hg backend should raise a FolderDoesNotExist exception if the folder doesn't actually exist. Currently, it returns [[], []]. An easy fix:
def list_directory(self, path, revision=None):
"""
Returns a list of files in a directory (list of strings) at a given
revision, or HEAD if revision is None.
"""
chgctx = self.repo.changectx(revision)
file_list = []
folder_list = []
found_path = False #Make sure we find path somewhere in the manifest.
for file, node in chgctx.manifest().items():
if not file.startswith(path):
continue
found_path = True #If we find anything in the manifest under this path, then this folder must exist.
folder_name = '/'.join(file.lstrip(path).split('/')[:-1])
if folder_name != '':
if folder_name not in folder_list:
folder_list.append(folder_name)
if '/' not in file.lstrip(path):
file_list.append(file)
if not found_path: #If we never found the path within the manifest, it does not exist.
raise FolderDoesNotExist
return file_list, folder_list
The list_directory(path) method in the hg backend should raise a FolderDoesNotExist exception if the folder doesn't actually exist. Currently, it returns [[], []]. An easy fix: