]> projects.mako.cc - mw/commitdiff
Store current revision ID in metadir
authorIan Weller <ian@ianweller.org>
Tue, 22 Dec 2009 09:04:47 +0000 (03:04 -0600)
committerIan Weller <ian@ianweller.org>
Tue, 22 Dec 2009 09:04:47 +0000 (03:04 -0600)
src/mw/clicommands.py
src/mw/metadir.py

index c180c6ada2f43af5c1b11e7dbda88ad2ca549989..60d98df9978e7fa33f5127d8c3e476a594484732 100644 (file)
@@ -96,8 +96,9 @@ class PullCommand(CommandBase):
                     print '%s: %s: page does not exist, file not created' % \
                             (self.me, pagename)
                     continue
-                revid = [x['revid'] for x in response[pageid]['revisions']]
-                self.metadir.pagedict_add(pagename, int(pageid))
+                revids = [x['revid'] for x in response[pageid]['revisions']]
+                revids.sort()
+                self.metadir.pagedict_add(pagename, pageid, revids[-1])
                 self.metadir.pages_add_rv(int(pageid),
                                           response[pageid]['revisions'][0])
                 filename = mw.api.pagename_to_filename(pagename)
index 4549a29ffc5b5d4ebba82abd03ab5bea1f2fa49e..67e0b0950a58b95c20cf8b11542c0a4346e1234c 100644 (file)
@@ -70,10 +70,10 @@ class Metadir(object):
         # create cache/pages/
         os.mkdir(os.path.join(self.location, 'cache', 'pages'), 0755)
 
-    def pagedict_add(self, pagename, pageid):
+    def pagedict_add(self, pagename, pageid, currentrv):
         fd = file(os.path.join(self.location, 'cache', 'pagedict'), 'r+')
         pagedict = json.loads(fd.read())
-        pagedict[pagename] = int(pageid)
+        pagedict[pagename] = {'id': int(pageid), 'currentrv': int(currentrv)}
         fd.seek(0)
         fd.write(json.dumps(pagedict))
         fd.truncate()

Benjamin Mako Hill || Want to submit a patch?