- 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])
- with file(os.path.join(self.metadir.root, filename + '.wiki'),
- 'w') as fd:
- data = response[pageid]['revisions'][0]['*']
- data = data.encode('utf-8')
- fd.write(data)
+
+ wiki_revids = sorted([x['revid'] for x in response[pageid]['revisions']])
+ last_wiki_revid = wiki_revids[-1]
+ working_revids = sorted(self.metadir.pages_get_rv_list({'id' : pageid}))
+ last_working_revid = working_revids[-1]
+ if ( os.path.exists(full_filename) and
+ last_wiki_revid == last_working_revid):
+ print 'wiki unchanged: %s' % (pagename)
+ else:
+ print 'pulling: %s : %s -- %s' % (
+ pagename, last_wiki_rev_comment, last_wiki_rev_user)
+ self.metadir.pagedict_add(pagename, pageid, last_wiki_revid)
+ self.metadir.pages_add_rv(int(pageid),
+ response[pageid]['revisions'][0])
+ with file(full_filename, 'w') as fd:
+ data = response[pageid]['revisions'][0]['*']
+ data = data.encode('utf-8')
+ fd.write(data)