Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadomir Dopieralski <hatta-dev@sheep.art.pl>2010-07-17 11:09:01 (GMT)
committer Radomir Dopieralski <hatta-dev@sheep.art.pl>2010-07-17 11:09:01 (GMT)
commita849c28d5945a2ac59119b6428c12b7a897fe166 (patch)
tree018cc07e25ed3c2a8eb5afc20137d468e1f028e9
parent6f04fcd96bb6fa10194fc133c4f4ff7d6db970db (diff)
Tweak the revision finding code, add changectx.rev()==0 check thanks to Prologic
-rwxr-xr-xhatta.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/hatta.py b/hatta.py
index b4f55ed..4f396f0 100755
--- a/hatta.py
+++ b/hatta.py
@@ -631,16 +631,17 @@ class WikiStorage(object):
"""Find the last revision in which the file existed."""
repo_file = self._title_to_file(title)
- changectx = self._changectx()
- stack = [changectx]
- while repo_file not in changectx:
- if not stack:
- return None
+ stack = [self._changectx()]
+ while stack:
changectx = stack.pop()
+ if repo_file in changectx:
+ return changectx[repo_file]
+ if changectx.rev() == 0:
+ return None
for parent in changectx.parents():
if parent != changectx:
stack.append(parent)
- return changectx[repo_file]
+ return None
def page_history(self, title):
"""Iterate over the page's history."""