self.api_url = api_url
self.metadir = metadir
self.cookiejar = cookielib.MozillaCookieJar(os.path.join(
- self.metadir.location, 'cookies'
- ))
+ self.metadir.location, 'cookies'))
try:
self.cookiejar.load()
except IOError:
self.parser = OptionParser(usage=usage, description=description)
self.name = name
self.metadir = mw.metadir.Metadir()
- #global_options = OptionGroup(self.parser, "Global Options")
- #global_options.add_option('-u', '--use-auth', action='store_true',
- # dest='use_auth', help='force authentication '
- # 'even if not required')
- #self.parser.add_option_group(global_options)
self.shortcuts = []
def main(self):
for file in status:
if status[file] == 'U':
print self.metadir.diff_rv_to_working(
- mw.api.filename_to_pagename(file[:-5])
- ),
+ mw.api.filename_to_pagename(file[:-5])),
class CommitCommand(CommandBase):
pagedata = json.loads(pagedata_raw)
rvid = int(rv['revid'])
pagedata[rvid] = {
- 'user': rv['user'], 'timestamp': rv['timestamp']
+ 'user': rv['user'],
+ 'timestamp': rv['timestamp'],
}
if '*' in rv.keys():
pagedata[rvid]['content'] = rv['*']
oldrvid = self.pages_get_rv_list(pageid)[-1]
oldrv = self.pages_get_rv(pageid, oldrvid)
oldname = 'a/%s (revision %i)' % (filename, oldrvid)
- old = [i+'\n' for i in oldrv['content'].split('\n')]
+ old = [i + '\n' for i in oldrv['content'].split('\n')]
if newrvid == 0:
cur_content = codecs.open(filename, 'r', 'utf-8').read()
if cur_content[-1] == '\n':
cur_content = cur_content[:-1]
newname = 'b/%s (working copy)' % filename
- new = [i+'\n' for i in cur_content.split('\n')]
+ new = [i + '\n' for i in cur_content.split('\n')]
else:
newrv = self.pages_get_rv(pageid, newrvid)
newname = 'b/%s (revision %i)' % (filename, newrvid)
- new = [i+'\n' for i in newrv['content'].split('\n')]
+ new = [i + '\n' for i in newrv['content'].split('\n')]
diff_fd = StringIO()
bzrlib.diff.internal_diff(oldname, old, newname, new, diff_fd)
diff_fd.seek(0)