Browse files

Merge git:// into hg

  • Loading branch information...
2 parents cd5d9a6 + 6e5fbe5 commit 016dfcc15bbafed2ea54de812148ab23b1dbd24f @alex alex committed Jul 11, 2009
Showing with 7 additions and 9 deletions.
  1. +7 −9 pyvcs/backends/
@@ -6,7 +6,7 @@
from mercurial.util import matchdate, Abort
from pyvcs.commit import Commit
-from pyvcs.exceptions import CommitDoesNotExist, FileDoesNotExist
+from pyvcs.exceptions import CommitDoesNotExist, FileDoesNotExist, FolderDoesNotExist
from pyvcs.repository import BaseRepository
from pyvcs.utils import generate_unified_diff
@@ -71,32 +71,30 @@ def list_directory(self, path, revision=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):
+ 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:
if '/' not in file.lstrip(path):
+ if not found_path: #If we never found the path within the manifest, it does not exist.
+ raise FolderDoesNotExist
return file_list, folder_list
def file_contents(self, path, revision=None):
Returns the contents of a file as a string at a given revision, or
HEAD if revision is None.
+ if revision is None:
+ revision = 'tip'
chgctx = self.repo.changectx(revision)
fctx = chgctx.filectx(path)
except KeyError:
raise FileDoesNotExist
- try:
- return
- except Abort:
- # If the path contains any banned components (under top-level .hg,
- # starts at the root of a windows drive, contains "..", traverses
- # a symlink (e.g. a/symlink_here/b), inside a nested repository),
- # then this exception will be raised.
- raise FileDoesNotExist

0 comments on commit 016dfcc

Please sign in to comment.