From 90afbee67cd871468f755c9a9769d53adca9941c Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Tue, 22 Dec 2009 03:04:47 -0600 Subject: [PATCH] Store current revision ID in metadir --- src/mw/clicommands.py | 5 +++-- src/mw/metadir.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mw/clicommands.py b/src/mw/clicommands.py index c180c6a..60d98df 100644 --- a/src/mw/clicommands.py +++ b/src/mw/clicommands.py @@ -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) diff --git a/src/mw/metadir.py b/src/mw/metadir.py index 4549a29..67e0b09 100644 --- a/src/mw/metadir.py +++ b/src/mw/metadir.py @@ -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() -- 2.39.5