X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/36f6233fd79390ad5af8a1532eac60a0ae57c825..c213dc7d88e8cb7e68d447d3be41a7dd306366e8:/lib/vstorage.py diff --git a/lib/vstorage.py b/lib/vstorage.py index 82151da7..b4acaf3a 100644 --- a/lib/vstorage.py +++ b/lib/vstorage.py @@ -328,16 +328,20 @@ class VersionedStorage(object): """Find the last revision in which the file existed.""" repo_file = self._title_to_file(title) changectx = self._changectx() # start with tip + visited = set() + stack = [changectx] + visited.add(changectx) while repo_file not in changectx: if not stack: - return None + raise DocumentNotFound(title) changectx = stack.pop() for parent in changectx.parents(): - if parent != changectx: + if parent not in visited: stack.append(parent) + visited.add(parent) try: fctx = changectx[repo_file]