X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/36f6233fd79390ad5af8a1532eac60a0ae57c825..404bfe407798a8a83fa02dc1742a315400b7c00b:/lib/vstorage.py?ds=sidebyside 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]