def report_fileinfo(request, report_id): report = get_object_or_404(Report, id=report_id) sfile = report.sourcefile() if not os.path.exists(sfile): return HttpResponse('FILEINFO, ERROR: %s does not exists' % sfile) rdir = report.tag.repo.dirname() ret, gitlog = execute_shell("cd %s; git log -n 20 --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, report.file)) fileinfo = '# git log -n 20 %s\n' % report.file fileinfo += report_format_gitinfo(report.tag.repo, gitlog) ret, gitlog = execute_shell("cd %s; /usr/bin/perl ./scripts/get_maintainer.pl -f %s --remove-duplicates --scm" % (rdir, report.file)) fileinfo += '\n\n# ./scripts/get_maintainer.pl -f %s --scm\n' % report.file fileinfo += gitlog if report.status in [STATUS_NEW, STATUS_PATCHED, STATUS_SENT]: count = 0 diff = report.diff if report.status == STATUS_NEW: diff = report.reportlog for line in find_remove_lines(diff): ret, gitlog = execute_shell("cd %s; git log -n 1 -S '%s' --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, line, report.file)) fileinfo += '\n# git log -n 1 -S \'%s\' %s\n' % (cgi.escape(line), report.file) fileinfo += report_format_gitinfo(report.tag.repo, gitlog) count += 1 if count > 4: break return HttpResponse('<pre>%s</pre>' % fileinfo)
def patch_fileinfo(request, patch_id): patch = Patch.objects.get(id=patch_id) sfile = patch.sourcefile() if not os.path.exists(sfile): return HttpResponse('FILEINFO, ERROR: %s does not exists' % sfile) rdir = patch.tag.repo.dirname() ret, gitlog = execute_shell( "cd %s; git log -n 20 --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, patch.file)) fileinfo = '# git log -n 20 %s\n' % patch.file fileinfo += patch_format_gitinfo(patch.tag.repo, gitlog) ret, gitlog = execute_shell( "cd %s; /usr/bin/perl ./scripts/get_maintainer.pl -f %s --remove-duplicates --scm" % (rdir, patch.file)) fileinfo += '\n\n# ./scripts/get_maintainer.pl -f %s --scm\n' % patch.file fileinfo += cgi.escape(gitlog) if patch.status in [STATUS_NEW, STATUS_SENT, STATUS_MARKED]: count = 0 for line in find_remove_lines(patch.diff): ret, gitlog = execute_shell( "cd %s; git log -n 1 -S '%s' --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, line, patch.file)) fileinfo += '\n# git log -n 1 -S \'%s\' %s\n' % (cgi.escape(line), patch.file) fileinfo += patch_format_gitinfo(patch.tag.repo, gitlog) count += 1 if count > 4: break return HttpResponse('<pre>%s</pre>' % fileinfo)
def patch_fileinfo(request, patch_id): patch = Patch.objects.get(id = patch_id) sfile = patch.sourcefile() if not os.path.exists(sfile): return HttpResponse('FILEINFO, ERROR: %s does not exists' % sfile) rdir = patch.tag.repo.dirname() ret, gitlog = execute_shell("cd %s; git log -n 20 --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, patch.file)) fileinfo = '# git log -n 20 %s\n' % patch.file fileinfo += patch_format_gitinfo(patch.tag.repo, gitlog) ret, gitlog = execute_shell("cd %s; /usr/bin/perl ./scripts/get_maintainer.pl -f %s --remove-duplicates --scm" % (rdir, patch.file)) fileinfo += '\n\n# ./scripts/get_maintainer.pl -f %s --scm\n' % patch.file fileinfo += cgi.escape(gitlog) if patch.status in [STATUS_NEW, STATUS_SENT, STATUS_MARKED]: count = 0 for line in find_remove_lines(patch.diff): ret, gitlog = execute_shell("cd %s; git log -n 1 -S '%s' --pretty=format:'%%ci||||%%an||||%%s||||%%H' %s" % (rdir, line, patch.file)) fileinfo += '\n# git log -n 1 -S \'%s\' %s\n' % (cgi.escape(line), patch.file) fileinfo += patch_format_gitinfo(patch.tag.repo, gitlog) count += 1 if count > 4: break return HttpResponse('<pre>%s</pre>' % fileinfo)