self._die_if_no_init()
status = self.metadir.working_dir_status()
for file in status:
- if status[file] == 'U':
+ if status[file] == 'M':
print self.metadir.diff_rv_to_working(
mw.metadir.filename_to_pagename(file[:-5])),
nothing_to_commit = True
for file in status:
print '%s %s' % (status[file], file)
- if status[file] in ['U']:
+ if status[file] in ['M']:
nothing_to_commit = False
if nothing_to_commit:
print 'nothing to commit'
edit_summary = raw_input()
else:
edit_summary = self.options.edit_summary
- for file in status:
- if status[file] in ['U']:
+ for file_num, file in enumerate(status):
+ if status[file] in ['M']:
# get edit token
data = {
'action': 'query',
print 'warning: edit conflict detected on %s (%s -> %s) ' \
'-- skipping!' % (file, awaitedrevid, revid)
continue
- edittoken = pages['pages'][pageid]['edittoken']
+ edittoken = pages[pageid]['edittoken']
filename = os.path.join(self.metadir.root, file)
text = codecs.open(filename, 'r', 'utf-8').read()
text = text.encode('utf-8')
response = self.api.call(data)['query']['pages']
self.metadir.pages_add_rv(int(pageid),
response[pageid]['revisions'][0])
- print 'waiting 10s before processing the next file'
- time.sleep(10)
+ if file_num != len(status) - 1:
+ print 'waiting 10s before processing the next file'
+ time.sleep(10)
else:
print 'error: committing %s failed: %s' % \
(file, response['edit']['result'])
if (len(cur_content) != 0) and (cur_content[-1] == '\n'):
cur_content = cur_content[:-1]
if cur_content != rv['content']:
- status[os.path.relpath(full, self.root)] = 'U'
+ status[os.path.relpath(full, self.root)] = 'M'
return status
def diff_rv_to_working(self, pagename, oldrvid=0, newrvid=0):