Changesets can be listed by changeset number.
The Git repository is here.
Changeset 264
Updated to cvslog2web version 1.16. This includes changes made for the
ROOL version of the script which were submitted back and subsequently
merged into the official source tree. Meanwhile, the previously checked-
in configuration file was from the 'devel' site tree; changed to 'live'.
- Comitted by: rool
- Date: Thursday April 23 18:46:14 2009 (over 15 years ago)
Affected files:
rool/python/cvslog2web/trunk/config.py:
prev. | current | |
# This setting controls the destination of the output | ||
2 | ||
2 | PERMALINKDIR="/home/rool/live/python/cvslog2web/public" | |
if not os.path.exists(PERMALINKDIR): | ||
os.makedirs(PERMALINKDIR) | ||
FEEDOUT="cvslog2web.xml" |
rool/python/cvslog2web/trunk/cvslog2web.py:
prev. | current | |
# cvslog2web by Ethan Tira-Thompson | ||
# Released under the GPL (http://www.gnu.org/copyleft/gpl.html) | ||
5 | ||
5 | # $Date: 2009/01/06 19:59:07 $ | |
# Provides syndicated (Atom) and HTML output from CVS commit logs | ||
7 | ||
7 | SCRIPT_REVISION="$Revision: 1.16 $" | |
SCRIPT_URL="http://ethan.tira-thompson.com/cvslog2web" | ||
################################################################################ | ||
... | ... | |
HTMLOUT_FILELIST=True # set to False to skip the file list (also skipped if ENTRYTITLE==TITLE_FILE_LIST ) | ||
HTMLOUT_MAXHISTORY=10 | ||
# Prefix author list with the given string in a nested SPAN of class | ||
146 | ||
146 | # 'cvslog2web_authorsprefix' and don't use parenthesis around names. | |
# Works best if CSS drops Authors span onto separate line, e.g. | ||
148 | ||
148 | # by setting 'display: block'. If the string is empty, uses parenthesis | |
# around the comma-separated names with no prefix span. | ||
HTMLOUT_AUTHORSPREFIX="" | ||
# HTMLOUT_ORDER allows you to define the order of items in the summary | ||
... | ... | |
HTMLOUT_TIMESTAMPFORMAT="%a. %B %d, %Y at %I:%M:%S %p" | ||
# Optional prefix string, under class 'cvslog2web_timestampprefix' within | ||
# the timestamp DIV. | ||
160 | ||
160 | HTMLOUT_TIMESTAMPPREFIX="Committed " | |
# Outer encapsulating DIV class for each entry in the list | ||
HTMLOUT_OUTERCLASS="cvslog2web_entry" | ||
... | ... | |
# Only fill this in if you are specifying an absolute URL (i.e. starts with http://) | ||
PERMALINK_URL_PREFIX="" | ||
# Prefix for images; normally they reside in the same place as the permalinks | ||
177 | ||
177 | PERMALINK_IMG_PREFIX="" # if empty string, will fall back to PERMALINK_URL_PREFIX, use None to disable | |
# strftime format string for permalink files -- can spread among subdirs with '/' | ||
# In a post-processing stage, microseconds are available via '%%(us)d' (with normal printf-style formatting, e.g. %%(us)06d) | ||
PERMALINK_STRUCTURE="commits/%Y/%m/commit-%d-%H-%M-%S-%%(us)06d.html" | ||
... | ... | |
FEEDID=FEEDSELFLINK | ||
if HTMLTITLE=="": | ||
HTMLTITLE=FEEDTITLE | ||
239 | if PERMALINK_IMG_PREFIX=="": | |
240 | PERMALINK_IMG_PREFIX=PERMALINK_URL_PREFIX | |
241 | elif not PERMALINK_IMG_PREFIX: | |
242 | PERMALINK_IMG_PREFIX=""; | |
if PERMALINK_CSS=="": | ||
if PERMALINK_URL_PREFIX: | ||
PERMALINK_CSS=PERMALINK_URL_PREFIX+HTMLOUT_CSS | ||
... | ... | |
section=modified | ||
elif line=="Removed Files:\n": | ||
section=removed | ||
345 | elif line.strip().startswith("Tag:"): | |
346 | pass #branch tag, currently no-op... eventually it would be nice to store and track this | |
elif imported and (line.startswith("Vendor Tag:") or line.startswith("Release Tags:")): | ||
message.append(line) | ||
section=importedFiles | ||
... | ... | |
else: | ||
t=GHOST | ||
return (ov,nv,t) | ||
474 | ||
480 | ||
for k,v in paths.iteritems(): | ||
if history[0][PATH].setdefault(k,v)!=v: | ||
history[0][PATH][k]=merge(history[0][PATH][k],v) | ||
history[0][TIMESTAMP]=curtime_str | ||
history[0][AUTHORS][user]=CONTACT.get(user,(user_name,user+"@"+DOMAIN)) | ||
480 | ||
486 | ||
else: # push paths as a new entry on its own | ||
authors={user:CONTACT.get(user,(user,user+"@"+DOMAIN))} | ||
history.insert(0,[paths,curtime,curtime_str,authors,message,importedFiles,importedTag]) | ||
... | ... | |
doc.insertBefore(doc.createProcessingInstruction("xml-stylesheet",'href="Atom.css" type="text/css"'),feed) | ||
feed.setAttribute("xmlns","http://www.w3.org/2005/Atom") | ||
feed.appendChild(doc.createTextNode("\n")) | ||
654 | ||
660 | ||
# feed header tags | ||
appendTextualTag(feed,"id",FEEDID) | ||
appendTextualTag(feed,"title",FEEDTITLE) | ||
... | ... | |
generator.setAttribute("version",SCRIPT_VERSION) | ||
generator.appendChild(doc.createTextNode("cvslog2web")) | ||
feed.appendChild(doc.createTextNode("\n")) | ||
680 | ||
686 | ||
for (entry,files,links) in zip(history,histFiles,histLinks)[:FEED_MAXHISTORY]: | ||
msg=entry[MESSAGE].splitlines() | ||
... | ... | |
else: | ||
linknode.setAttribute("href",(VIEWLINKFORMAT % l).replace(" ","%20")) | ||
linknode.setAttribute("type","text/html") | ||
719 | ||
725 | ||
# CONTENT section | ||
content=node.appendChild(doc.createElement("content")) | ||
content.setAttribute("type","xhtml") | ||
... | ... | |
continue | ||
appendTextualTag(content,"div",m).setAttribute("style","padding:.25em 0;") | ||
# End of message embedding | ||
731 | ||
737 | ||
#now add links to content | ||
filelist=content.appendChild(doc.createElement("div")) | ||
if len(msg)>1: | ||
... | ... | |
diffs.appendChild(doc.createTextNode("}")) | ||
firstSet=False | ||
filelist.appendChild(doc.createTextNode("\n")) | ||
762 | ||
768 | ||
#end of content | ||
node.appendChild(doc.createTextNode("\n")) | ||
765 | ||
771 | ||
f=open(FEEDOUT,"wb") | ||
doc.writexml(f) | ||
f.close() | ||
... | ... | |
rootdiv.setAttribute("class","cvslog2web_index") | ||
else: | ||
doc,rootdiv=HTMLHeader(dom,HTMLTITLE,HTMLOUT_CSS,"cvslog2web_index") | ||
850 | ||
856 | ||
for (entry,files,links) in zip(history,histFiles,histLinks)[:HTMLOUT_MAXHISTORY]: | ||
msg=entry[MESSAGE].splitlines() | ||
... | ... | |
else: sys.exit("cvslog2web: bad ENTRYTITLE setting") | ||
else: | ||
titlenode.appendChild(doc.createTextNode(HTMLOUT_ENTRYPREFIX)) | ||
874 | | |
875 | | |
880 | if ENTRYTITLE==TITLE_MESSAGE_FIRST_LINE and len(msg)>0: appendTextualTag(titlenode,"span",msg[0]).setAttribute("class","cvslog2web_message") | |
881 | elif ENTRYTITLE==TITLE_FILE_LIST or len(msg)==0: appendTextualTag(titlenode,"span",files).setAttribute("class","cvslog2web_filelist") | |
else: sys.exit("cvslog2web: bad ENTRYTITLE setting") | ||
titlenode.appendChild(doc.createTextNode(" ")) | ||
... | ... | |
#end of content | ||
node.appendChild(doc.createTextNode("\n")) | ||
932 | ||
938 | ||
gen=rootdiv.appendChild(doc.createElement("div")) | ||
gen.setAttribute("class","cvslog2web_credit") | ||
gen.appendChild(doc.createTextNode("Generated by ")) | ||
... | ... | |
a.setAttribute("target","_top") | ||
a.setAttribute("href",SCRIPT_URL) | ||
gen.appendChild(doc.createTextNode(SCRIPT_VERSION)) | ||
940 | ||
946 | ||
f=open(HTMLOUT,"wb") | ||
if HTMLOUT_STANDALONE or "createDocumentFragment" in dir(dom): | ||
doc.writexml(f) | ||
... | ... | |
def writePermalink(entry,files,links,prevLink="",nextLink=""): | ||
if prevLink: prevLink=normalizeLink(prevLink) | ||
if nextLink: nextLink=normalizeLink(nextLink) | ||
970 | ||
976 | ||
permalink=genPermalink(entry[DATETIME]) | ||
permafile=genPermafile(entry[DATETIME]) | ||
permdir=os.path.dirname(permafile) | ||
... | ... | |
if not os.path.isdir(permdir): sys.exit("cvslog2web: file blocking PERMALINKDIR "+permdir) | ||
else: | ||
os.makedirs(permdir) | ||
978 | ||
984 | ||
msg=entry[MESSAGE].splitlines() | ||
# entry header tags | ||
... | ... | |
node=rootdiv.appendChild(doc.createElement("div")) | ||
node.setAttribute("class",PERMALINK_OUTERCLASS) | ||
node.appendChild(doc.createTextNode("\n")) | ||
1005 | ||
1011 | ||
for section in PERMALINK_ORDER: | ||
# Previous link | ||
if section==PL_PREVLINK: | ||
... | ... | |
else: | ||
n.setAttribute("class","cvslog2web_nav_prev_disabled") | ||
n.appendChild(doc.createTextNode(PL_PREVTEXT)) | ||
1019 | ||
1025 | ||
# Previous link | ||
elif section==PL_NEXTLINK: | ||
n=node.appendChild(doc.createElement("div")) | ||
... | ... | |
else: | ||
n.setAttribute("class","cvslog2web_nav_next_disabled") | ||
n.appendChild(doc.createTextNode(PL_NEXTTEXT)) | ||
1032 | ||
1038 | ||
# Feed link | ||
elif section==PL_FEEDLINK and FEEDOUT and FEEDSELFLINK: | ||
n=node.appendChild(doc.createElement("div")) | ||
... | ... | |
i.setAttribute("src",normalizeLink(PERMALINK_IMG_PREFIX+"atom_feed.png")) | ||
i.setAttribute("width","84") | ||
i.setAttribute("height","15") | ||
1043 | | |
1049 | i.setAttribute("alt","Atom Badge") | |
a.appendChild(doc.createTextNode(" ")) | ||
i=a.appendChild(doc.createElement("img")) | ||
i.setAttribute("src",normalizeLink(PERMALINK_IMG_PREFIX+"feed_icon.png")) | ||
i.setAttribute("width","15") | ||
i.setAttribute("height","15") | ||
1049 | | |
1055 | i.setAttribute("alt","Feed Icon") | |
# Title (Timestamp) | ||
elif section==PL_TIMESTAMP: | ||
... | ... | |
tz=time.tzname[0] | ||
title=t.strftime("Commited %a. %B %d, %Y at %I:%M:%S %p "+tz) | ||
appendTextualTag(node,"div",title).setAttribute("class","cvslog2web_timestamp") | ||
1061 | ||
1067 | ||
# Authors | ||
elif section==PL_AUTHORS: | ||
authors=node.appendChild(doc.createElement("div")) | ||
... | ... | |
else: authors.appendChild(doc.createTextNode(", ")) | ||
l=appendTextualTag(authors,"a",n[0]) | ||
l.setAttribute("href","mailto:"+n[1]) | ||
1073 | ||
1079 | ||
# Message | ||
elif section==PL_MESSAGE: | ||
content=node.appendChild(doc.createElement("div")) | ||
... | ... | |
content.appendChild(doc.createTextNode("\n"+m)) | ||
content.appendChild(doc.createElement("br")) | ||
content.appendChild(doc.createTextNode("\n")) | ||
1082 | ||
1088 | ||
# Links | ||
elif section==PL_FILELIST: | ||
links=node.appendChild(doc.createElement("div")) | ||
... | ... | |
a.appendChild(doc.createTextNode(dropModules(f[1]))) | ||
links.appendChild(doc.createElement("br")) | ||
links.appendChild(doc.createTextNode("\n")) | ||
1124 | ||
1130 | ||
# Special content (user defined string?) | ||
elif section.__class__=="".__class__: | ||
if not section.strip().startswith("<"): | ||
... | ... | |
for n in subdoc.childNodes: | ||
node.appendChild(subdoc.removeChild(n)) | ||
subdoc.unlink() | ||
1137 | ||
1143 | ||
#put a return in the source after eact section | ||
node.appendChild(doc.createTextNode("\n")) | ||
... | ... | |
a.setAttribute("target","_top") | ||
a.setAttribute("href",SCRIPT_URL) | ||
gen.appendChild(doc.createTextNode(SCRIPT_VERSION)) | ||
1152 | ||
1158 | ||
f=open(permafile,"wb") | ||
if PERMALINK_STANDALONE or "createDocumentFragment" in dir(dom): | ||
doc.writexml(f) | ||
... | ... | |
curpl=genPermalinkEntry(0) | ||
if len(history)>1: | ||
writePermalink(history[1],histFiles[1],histLinks[1],genPermalinkEntry(2),curpl) | ||
1196 |