do not skip even lines in history
This commit is contained in:
parent
c23c74062f
commit
c99941ec5b
2 changed files with 35 additions and 9 deletions
25
diffido.py
25
diffido.py
|
@ -36,6 +36,7 @@ DEFAULT_CONF = 'conf/diffido.conf'
|
|||
EMAIL_FROM = 'diffido@localhost'
|
||||
GIT_CMD = 'git'
|
||||
|
||||
re_commit = re.compile(r'[0-9a-f]{40} ')
|
||||
re_insertion = re.compile(r'(\d+) insertion')
|
||||
re_deletion = re.compile(r'(\d+) deletion')
|
||||
|
||||
|
@ -188,20 +189,26 @@ def get_history(id_):
|
|||
commit_line = res_io.readline().strip()
|
||||
if not commit_line:
|
||||
break
|
||||
commit_id, message = commit_line.split(' ', 1)
|
||||
if re_commit.match(commit_line):
|
||||
commit_id, message = commit_line.split(' ', 1)
|
||||
if len(commit_id) != 40:
|
||||
continue
|
||||
changes_line = res_io.readline().strip()
|
||||
insert = re_insertion.findall(changes_line)
|
||||
if insert:
|
||||
insert = int(insert[0])
|
||||
else:
|
||||
if re_commit.match(changes_line):
|
||||
commit_id, message = changes_line.split(' ', 1)
|
||||
insert = 0
|
||||
delete = re_deletion.findall(changes_line)
|
||||
if delete:
|
||||
delete = int(delete[0])
|
||||
else:
|
||||
delete = 0
|
||||
else:
|
||||
insert = re_insertion.findall(changes_line)
|
||||
if insert:
|
||||
insert = int(insert[0])
|
||||
else:
|
||||
insert = 0
|
||||
delete = re_deletion.findall(changes_line)
|
||||
if delete:
|
||||
delete = int(delete[0])
|
||||
else:
|
||||
delete = 0
|
||||
history.append({'id': commit_id, 'message': message, 'insertions': insert, 'deletions': delete,
|
||||
'changes': max(insert, delete)})
|
||||
lastid = None
|
||||
|
|
19
dist/index.html
vendored
19
dist/index.html
vendored
|
@ -23,6 +23,7 @@
|
|||
<md-table-cell md-label="#" md-sort-by="id" md-numeric><a :href="'/schedule.html?id=' + item.id">${ item.id }</a></md-table-cell>
|
||||
<md-table-cell md-label="title" md-sort-by="title"><a :href="'/schedule.html?id=' + item.id">${ item.title }</a></md-table-cell>
|
||||
<md-table-cell md-label="url" md-sort-by="email"><a :href="item.url" target="_new">${ item.url }</a></md-table-cell>
|
||||
<md-table-cell md-label="trigger" md-sort-by="trigger">${ triggerString(item) }</md-table-cell>
|
||||
<md-table-cell md-label="history" md-sort-by="email">
|
||||
<md-button :href="'/history.html?id=' + item.id" class="md-icon-button md-primary">
|
||||
<md-icon>history</md-icon>
|
||||
|
@ -62,6 +63,24 @@ var app = new Vue({
|
|||
});
|
||||
self.schedules = schedules;
|
||||
});
|
||||
},
|
||||
triggerString: function(item) {
|
||||
if (item.trigger == 'cron') {
|
||||
return 'cron: ' + item.cron_crontab;
|
||||
}
|
||||
if (item.trigger == 'interval') {
|
||||
trigger = 'interval: ';
|
||||
_.each(['weeks', 'days', 'hours', 'minutes', 'seconds'], function(value, key) {
|
||||
if ('interval_' + value) {
|
||||
if (trigger) {
|
||||
trigger = trigger + ' ';
|
||||
}
|
||||
trigger = trigger + ''
|
||||
}
|
||||
});
|
||||
return trigger;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue