Skip to content

Instantly share code, notes, and snippets.

@ianhinder
Created May 1, 2012 08:50
Show Gist options
  • Save ianhinder/2566498 to your computer and use it in GitHub Desktop.
Save ianhinder/2566498 to your computer and use it in GitHub Desktop.
Git super-repository changelog
table
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 10pt;
background: #fff;
margin: 10px;
width: 90%;
border-collapse: collapse;
text-align: left;
}
th
{
font-size: 14px;
font-weight: bold;
padding: 10px 0px;
text-align: left;
}
th.date
{
width : 17ex;
}
tr
{
border-bottom: 1px solid #ccc;
padding: 8px 8px;
}
td
{
padding: 4px;
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Einstein Toolkit changelog since ET_2011_10</title>
<link href="log.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>Einstein Toolkit changelog since ET_2011_10</h1>
<xsl:for-each select="changelog/repo">
<h2><xsl:value-of select="name"/></h2>
<table>
<tr>
<th class="date">Date</th>
<th>Log</th>
</tr>
<xsl:for-each select="commit">
<tr>
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="log"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $(basename $0) <branch>"
exit 1
fi
branch="$1"
echo "<?xml version='1.0'?>"
echo '<?xml-stylesheet type="text/xsl" href="log.xsl"?>'
echo "<changelog>"
repostart="<repo>"
repoend="</repo>"
reponame="<name>"
reponameend="</name>"
date="<date>"
dateend="</date>"
log="<log><![CDATA["
logend="]]></log>"
commit="<commit>"
commitend="</commit>"
git submodule --quiet foreach "if git log origin/${branch}.. >/dev/null 2>/dev/null; then if [ ! -z \"\$(git log origin/${branch}..)\" ]; then echo; echo \"${repostart}${reponame}\$(basename \$name)${reponameend}\"; if ! git --no-pager log --reverse --date=short --format=\" ${commit}${date}%ad${dateend} ${log}%s${logend}${commitend}\" origin/${branch}..; then echo \"Cannot find $branch branch\"; fi; echo \"${repoend}\"; fi; fi" | sed -e "s/^Entering '\(.*\)'/\1/g"
echo "</changelog>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment