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'
|
EMAIL_FROM = 'diffido@localhost'
|
||||||
GIT_CMD = 'git'
|
GIT_CMD = 'git'
|
||||||
|
|
||||||
|
re_commit = re.compile(r'[0-9a-f]{40} ')
|
||||||
re_insertion = re.compile(r'(\d+) insertion')
|
re_insertion = re.compile(r'(\d+) insertion')
|
||||||
re_deletion = re.compile(r'(\d+) deletion')
|
re_deletion = re.compile(r'(\d+) deletion')
|
||||||
|
|
||||||
|
@ -188,20 +189,26 @@ def get_history(id_):
|
||||||
commit_line = res_io.readline().strip()
|
commit_line = res_io.readline().strip()
|
||||||
if not commit_line:
|
if not commit_line:
|
||||||
break
|
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:
|
if len(commit_id) != 40:
|
||||||
continue
|
continue
|
||||||
changes_line = res_io.readline().strip()
|
changes_line = res_io.readline().strip()
|
||||||
insert = re_insertion.findall(changes_line)
|
if re_commit.match(changes_line):
|
||||||
if insert:
|
commit_id, message = changes_line.split(' ', 1)
|
||||||
insert = int(insert[0])
|
|
||||||
else:
|
|
||||||
insert = 0
|
insert = 0
|
||||||
delete = re_deletion.findall(changes_line)
|
|
||||||
if delete:
|
|
||||||
delete = int(delete[0])
|
|
||||||
else:
|
|
||||||
delete = 0
|
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,
|
history.append({'id': commit_id, 'message': message, 'insertions': insert, 'deletions': delete,
|
||||||
'changes': max(insert, delete)})
|
'changes': max(insert, delete)})
|
||||||
lastid = None
|
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="#" 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="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="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-table-cell md-label="history" md-sort-by="email">
|
||||||
<md-button :href="'/history.html?id=' + item.id" class="md-icon-button md-primary">
|
<md-button :href="'/history.html?id=' + item.id" class="md-icon-button md-primary">
|
||||||
<md-icon>history</md-icon>
|
<md-icon>history</md-icon>
|
||||||
|
@ -62,6 +63,24 @@ var app = new Vue({
|
||||||
});
|
});
|
||||||
self.schedules = schedules;
|
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