The real problem is that repo.changectx(None) returns a workingctx rather than a changectx. This is a context representing the "working directory", and it behaves oddly in several cases.
However, I think that pyvcs really wants to return the 'tip' (much like the svn 'head') rather than the working directory. This appears to be what the svn backend does, though I don't fully understand that code.
A simple fix to get the tip:
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)
try:
fctx = chgctx.filectx(path)
except KeyError:
raise FileDoesNotExist
Closed by 77cdc14d53ba9560169ba65822385be858359456, #4. Fixes a bunch of wonkiness with filebrowsing and mercurial, thanks to Chris Stucchio for his help
Continuation of Issue 2:
The real problem is that repo.changectx(None) returns a workingctx rather than a changectx. This is a context representing the "working directory", and it behaves oddly in several cases.
However, I think that pyvcs really wants to return the 'tip' (much like the svn 'head') rather than the working directory. This appears to be what the svn backend does, though I don't fully understand that code.
A simple fix to get the tip: