diff options
Diffstat (limited to 'tools/Changelog')
-rw-r--r-- | tools/Changelog/Changelog.cpp | 149 | ||||
-rw-r--r-- | tools/Changelog/Changelog.exe | bin | 0 -> 114688 bytes | |||
-rwxr-xr-x | tools/Changelog/Changelog.py | 101 | ||||
-rw-r--r-- | tools/Changelog/Changelog.sln | 21 | ||||
-rw-r--r-- | tools/Changelog/Changelog.vcproj | 179 | ||||
-rw-r--r-- | tools/Changelog/Makefile | 2 | ||||
-rw-r--r-- | tools/Changelog/stdafx.cpp | 29 | ||||
-rw-r--r-- | tools/Changelog/stdafx.h | 36 |
8 files changed, 517 insertions, 0 deletions
diff --git a/tools/Changelog/Changelog.cpp b/tools/Changelog/Changelog.cpp new file mode 100644 index 0000000000..e3a3a7cabd --- /dev/null +++ b/tools/Changelog/Changelog.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +// Changelog.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +#include "tinyxml.h" +#include "../../xbmc/utils/RegExp.h" + +#ifdef _LINUX +#define _tmain main +#define _TCHAR char +#endif + +const char header[] = "*************************************************************************************************************\r\n" + "*************************************************************************************************************\r\n" + " XBMC CHANGELOG\r\n" + "*************************************************************************************************************\r\n" + "*************************************************************************************************************\r\n" + "\r\n" + "Date Rev Message\r\n" + "=============================================================================================================\r\n"; + +const char filter[][100] = {"[- ]*[0-9]+-[0-9]+-[0-9]+ *", + "\\*\\*\\* empty log message \\*\\*\\*", + "no message" }; + +std::string FilterMessage(std::string message) +{ + std::string filteredMessage = message; + CRegExp reg; + for (int i = 0; i < sizeof(filter) / 100; i++) + { + reg.RegComp(filter[i]); + int findStart = reg.RegFind(message.c_str()); + while (findStart >= 0) + { + filteredMessage = message.substr(0, findStart); + filteredMessage.append(message.substr(findStart + reg.GetFindLen(), message.length())); + message = filteredMessage; + findStart = reg.RegFind(message.c_str()); + } + } + return filteredMessage; +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + std::string input = "svn_log.xml"; + std::string output = "Changelog.txt"; + int limit = 0; + + if (argc < 2) + { + // output help information + printf("usage:\n"); + printf("\n"); + printf(" Changelog input <output> <limit>\n"); + printf("\n"); + printf(" input : input .xml file generated from SVN (using svn log --xml)\n"); + printf(" DOWNLOAD to download direct from XBMC SVN\n"); + printf(" <output> : output .txt file for the changelog (defaults to Changelog.txt)\n"); + printf(" <limit> : the number of log entries for svn to fetch. (defaults to no limit)"); + printf("\n"); + return 0; + } + input = argv[1]; + if (argc > 2) + output = argv[2]; + FILE *file = fopen(output.c_str(), "wb"); + if (!file) + return 1; + fprintf(file, header); + if (input.compare("download") == 0) + { + if(argc > 3) + limit = atoi(argv[3]); + // download our input file + std::string command = "svn log -r 'HEAD':8638 "; + if (limit > 0) + { + command += "--limit "; + command += argv[3]; // the limit as a string + command += " "; + } +#ifndef _LINUX + command += "--xml https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/XBMC > svn_log.xml"; +#else + command += "--xml https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC > svn_log.xml"; +#endif + printf("Downloading changelog from SVN - this will take some time (around 1MB to download with no limit)\n"); + system(command.c_str()); + input = "svn_log.xml"; + printf("Downloading done - processing\n"); + } + TiXmlDocument doc; + if (!doc.LoadFile(input.c_str())) + { + return 1; + } + + TiXmlElement *root = doc.RootElement(); + if (!root) return 1; + + TiXmlElement *logitem = root->FirstChildElement("logentry"); + while (logitem) + { + int revision; + logitem->Attribute("revision", &revision); + TiXmlNode *date = logitem->FirstChild("date"); + std::string dateString; + if (date && date->FirstChild()) + dateString = date->FirstChild()->Value(); + TiXmlNode *msg = logitem->FirstChild("msg"); + if (msg && msg->FirstChild()) + { + // filter the message a bit + std::string message = FilterMessage(msg->FirstChild()->Value()); + if (message.size()) + fprintf(file, "%s %4i %s\r\n", dateString.substr(0,10).c_str(), revision, message.c_str()); + else + int breakhere = 1; + } + logitem = logitem->NextSiblingElement("logentry"); + } + fclose(file); + printf("Changelog saved as: %s\n", output.c_str()); + return 0; +} diff --git a/tools/Changelog/Changelog.exe b/tools/Changelog/Changelog.exe Binary files differnew file mode 100644 index 0000000000..5571d90375 --- /dev/null +++ b/tools/Changelog/Changelog.exe diff --git a/tools/Changelog/Changelog.py b/tools/Changelog/Changelog.py new file mode 100755 index 0000000000..74c35e9916 --- /dev/null +++ b/tools/Changelog/Changelog.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python + +import re, os, sys + +def usage (): + print " Changelog.py [option]" + print " -h : display this message" + print " -r <REV> : get log messages up until REV" + print " -d <DIR> : place Changelog.txt in DIR" + sys.exit() + + +header = "*************************************************************************************************************\n" \ + "*************************************************************************************************************\n" \ + " XBMC CHANGELOG\n" \ + "*************************************************************************************************************\n" \ + "*************************************************************************************************************" \ + "\nDate Rev Message\n" \ + "=============================================================================================================\n" + +xmlre = re.compile("^<logentry.*?revision=\"([0-9]{4,})\".*?<date>([0-9]{4}-[0-9]{2}-[0-9]{2})T.*?<msg>(.*?)</msg>.*?</logentry>$", re.MULTILINE | re.DOTALL) +txtre = re.compile("([0-9]{4}-[0-9]{2}-[0-9]{2}) ([0-9]{4,5}) {1,2}(.*)") + +old = None +lastrev = 8638 +rev = 1000000 +dir = "." + +nargs = len(sys.argv) +args = sys.argv + +i = 1 +while i < nargs: + if args[i] == "-r": + i += 1 + try: + rev = int(sys.argv[i]) + except: + rev=1000000 + elif args[i] == "-d": + i+=1 + dir = args[i].replace(' ', '\ ') + elif args[i] == "-h" or args[i] == "--help": + usage() + i+=1 + +# print dir +# print rev + +try: + old = open("%s/Changelog.txt" % (dir)) +except: + old = None + +if old != None: + olddoc = old.read() + old.close() + oldmsgs = txtre.findall(olddoc) + del olddoc + if len(oldmsgs) > 0: + lastrev = int(oldmsgs[0][1]) +try: + output = open("%s/Changelog.txt" % (dir),"w") +except: + print "Can't open %s/Changelog.txt for writing." % (dir) + sys.exit() + +output.write(header) + +if rev <= lastrev: + for msg in oldmsgs: + if int(msg[1]) <= rev: + s = "%-11.11s %-5.5s %s\n" % (msg[0], msg[1], msg[2]) + output.write(s) + sys.exit() + +svncmd = "svn log --xml -r %s:HEAD" % (lastrev) +newlog = os.popen(svncmd) + +newlogdoc = newlog.read() +newlog.close() + +newmsgs = xmlre.findall(newlogdoc) + +newmsgs.reverse() + +for msg in newmsgs: + s = "%-11.11s %-5.5s %s\n" % (msg[1], msg[0], msg[2].replace('\n','')) + output.write(s) + +skip = 0 +if old != None: + for msg in oldmsgs: + if skip == 1: + s = "%-11.11s %-5.5s %s\n" % (msg[0], msg[1], msg[2]) + output.write(s) + else: + skip = 1 + +output.close() + diff --git a/tools/Changelog/Changelog.sln b/tools/Changelog/Changelog.sln new file mode 100644 index 0000000000..d322696c4f --- /dev/null +++ b/tools/Changelog/Changelog.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Changelog", "Changelog.vcproj", "{05525588-A93C-4220-8C26-A93FBCE525BD}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {05525588-A93C-4220-8C26-A93FBCE525BD}.Debug.ActiveCfg = Debug|Win32
+ {05525588-A93C-4220-8C26-A93FBCE525BD}.Debug.Build.0 = Debug|Win32
+ {05525588-A93C-4220-8C26-A93FBCE525BD}.Release.ActiveCfg = Release|Win32
+ {05525588-A93C-4220-8C26-A93FBCE525BD}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/tools/Changelog/Changelog.vcproj b/tools/Changelog/Changelog.vcproj new file mode 100644 index 0000000000..5e205f56dd --- /dev/null +++ b/tools/Changelog/Changelog.vcproj @@ -0,0 +1,179 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Changelog"
+ ProjectGUID="{05525588-A93C-4220-8C26-A93FBCE525BD}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../guilib/tinyxml"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Changelog.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Changelog.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../guilib/tinyxml"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="4"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Changelog.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\Changelog.cpp">
+ </File>
+ <File
+ RelativePath="..\..\xbmc\utils\RegExp.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinystr.cpp">
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinyxml.cpp">
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinyxmlerror.cpp">
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinyxmlparser.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath="..\..\xbmc\utils\RegExp.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinystr.h">
+ </File>
+ <File
+ RelativePath="..\..\guilib\tinyXML\tinyxml.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tools/Changelog/Makefile b/tools/Changelog/Makefile new file mode 100644 index 0000000000..c2b5c94171 --- /dev/null +++ b/tools/Changelog/Makefile @@ -0,0 +1,2 @@ +Changelog: Changelog.cpp + g++ -D_LINUX -I../../guilib/tinyXML -o Changelog Changelog.cpp ../../guilib/tinyXML/*.o ../../xbmc/utils/RegExp.o diff --git a/tools/Changelog/stdafx.cpp b/tools/Changelog/stdafx.cpp new file mode 100644 index 0000000000..5cd322741d --- /dev/null +++ b/tools/Changelog/stdafx.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +// stdafx.cpp : source file that includes just the standard includes +// Changelog.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/tools/Changelog/stdafx.h b/tools/Changelog/stdafx.h new file mode 100644 index 0000000000..12f4e100cc --- /dev/null +++ b/tools/Changelog/stdafx.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +#include <iostream> +#ifndef _LINUX +#include <tchar.h> + +// TODO: reference additional headers your program requires here +#include <windows.h> +#endif |