Browse Source

SVNChangelogToXml: use Svn.Net instead of NSvn

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2978 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
18e4ccc0d5
  1. 3
      data/ConversionStyleSheets/SVNChangelogToXml.xsl
  2. 73
      src/Tools/SVNChangeLogToXml/Main.cs
  3. 72
      src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj
  4. 6
      src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln

3
data/ConversionStyleSheets/SVNChangelogToXml.xsl

@ -76,6 +76,9 @@
<xsl:when test="$orig_author = 'russellwilkins'"> <xsl:when test="$orig_author = 'russellwilkins'">
<xsl:text>Russell Wilkins</xsl:text> <xsl:text>Russell Wilkins</xsl:text>
</xsl:when> </xsl:when>
<xsl:when test="$orig_author = 'robertpickering'">
<xsl:text>Robert Pickering</xsl:text>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="./author" /> <xsl:value-of select="./author" />
</xsl:otherwise> </xsl:otherwise>

73
src/Tools/SVNChangeLogToXml/Main.cs

@ -7,8 +7,8 @@ using System.Xml.Xsl;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using NSvn.Common; using PumaCode.SvnDotNet.AprSharp;
using NSvn.Core; using PumaCode.SvnDotNet.SubversionSharp;
class MainClass class MainClass
{ {
@ -51,7 +51,22 @@ class MainClass
static void CreateRevisionFile() static void CreateRevisionFile()
{ {
Console.Write("Writing revision to file: "); Console.Write("Writing revision to file: ");
int rev = new Client().SingleStatus(".").Entry.Revision;
SvnClient client = new SvnClient();
string filename = Path.GetFullPath(".");
int rev = 0;
client.Status2(
filename, Svn.Revision.Working,
delegate (IntPtr baton, SvnPath path, SvnWcStatus2 status) {
if (StringComparer.InvariantCultureIgnoreCase.Equals(filename, path.Value)) {
rev = status.Entry.Revision;
}
},
IntPtr.Zero,
false, true, false, false, false
);
client.GlobalPool.Destroy();
Console.WriteLine(rev); Console.WriteLine(rev);
using (StreamWriter writer = new StreamWriter("../REVISION")) { using (StreamWriter writer = new StreamWriter("../REVISION")) {
writer.Write(rev.ToString()); writer.Write(rev.ToString());
@ -62,28 +77,38 @@ class MainClass
{ {
Console.WriteLine("Reading SVN changelog, this might take a while..."); Console.WriteLine("Reading SVN changelog, this might take a while...");
Client client = new Client(); SvnClient client = new SvnClient();
client.AuthBaton.Add(AuthenticationProvider.GetUsernameProvider()); client.AddUsernameProvider();
client.AuthBaton.Add(AuthenticationProvider.GetSimpleProvider()); client.AddSimpleProvider();
client.AuthBaton.Add(AuthenticationProvider.GetSimplePromptProvider(PasswordPrompt, 3)); client.OpenAuth();
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(writer); XmlTextWriter xmlWriter = new XmlTextWriter(writer);
xmlWriter.Formatting = Formatting.Indented; xmlWriter.Formatting = Formatting.Indented;
xmlWriter.WriteStartDocument(); xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("log"); xmlWriter.WriteStartElement("log");
client.Log(new string[] {".."}, Revision.Base, Revision.FromNumber(startRevision), false, false, int progressCount = 0;
delegate(LogMessage message) { client.Log2(
xmlWriter.WriteStartElement("logentry"); new SvnPath[] { new SvnPath("..", client.Pool)},
xmlWriter.WriteAttributeString("revision", message.Revision.ToString(System.Globalization.CultureInfo.InvariantCulture)); Svn.Revision.Base, new SvnRevision(startRevision),
xmlWriter.WriteElementString("author", message.Author); int.MaxValue, false, false,
xmlWriter.WriteElementString("date", message.Date.ToString("MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture)); delegate(IntPtr baton, AprHash changed_paths, int revision, AprString author, AprString date, AprString message, AprPool pool) {
xmlWriter.WriteElementString("msg", message.Message); if (++progressCount == 10) {
xmlWriter.WriteEndElement(); Console.Write(".");
}); progressCount = 0;
}
xmlWriter.WriteStartElement("logentry");
xmlWriter.WriteAttributeString("revision", revision.ToString(System.Globalization.CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("author", author.Value);
xmlWriter.WriteElementString("date", DateTime.Parse(date.Value).ToUniversalTime().ToString("MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("msg", message.Value);
xmlWriter.WriteEndElement();
return SvnError.NoError;
},
IntPtr.Zero);
xmlWriter.WriteEndDocument(); xmlWriter.WriteEndDocument();
//Console.WriteLine(writer); Console.WriteLine();
XmlTextReader input = new XmlTextReader(new StringReader(writer.ToString())); XmlTextReader input = new XmlTextReader(new StringReader(writer.ToString()));
@ -96,17 +121,9 @@ class MainClass
xsl.Transform(input, xmlWriter); xsl.Transform(input, xmlWriter);
xmlWriter.Close(); xmlWriter.Close();
tw.Close(); tw.Close();
client.GlobalPool.Destroy();
Console.WriteLine("Finished"); Console.WriteLine("Finished");
} }
static SimpleCredential PasswordPrompt(string realm, string userName, bool maySave)
{
Console.WriteLine();
Console.WriteLine("SUBVERSION: Authentication for realm: " + realm);
Console.Write("Username: ");
userName = Console.ReadLine();
Console.Write("Password: ");
string pwd = Console.ReadLine();
return new SimpleCredential(userName, pwd, maySave);
}
} }

72
src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj

@ -38,48 +38,52 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AprSharp">
<HintPath>..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\AprSharp.dll</HintPath>
</Reference>
<Reference Include="SubversionSharp">
<HintPath>..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\SubversionSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="NSvn.Common">
<HintPath>..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\NSvn.Common.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="NSvn.Core">
<HintPath>..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\NSvn.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
</ItemGroup> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\intl3_svn.dll">
<ItemGroup> <Link>intl3_svn.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LIBAPR.DLL"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>LIBAPR.DLL</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libapr.dll">
</Content> <Link>libapr.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibAprIconv.Dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>LibAprIconv.Dll</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libapriconv.dll">
</Content> <Link>libapriconv.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibAprUtil.Dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>LibAprUtil.Dll</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libaprutil.dll">
</Content> <Link>libaprutil.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\msvcp70.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>msvcp70.dll</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libdb44.dll">
</Content> <Link>libdb44.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibDB44.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>LibDB44.dll</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libeay32.dll">
</Content> <Link>libeay32.dll</Link>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\msvcr70.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>msvcr70.dll</Link> </None>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\ssleay32.dll">
</Content> <Link>ssleay32.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\svn_client-1.dll">
<Link>svn_client-1.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project> </Project>

6
src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln

@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 9.00 
# SharpDevelop 2.1.0.1673 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# SharpDevelop 3.0.0.2967
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVNChangelogToXml", "SVNChangelogToXml.csproj", "{c6159c5e-f6ef-4a63-b152-0e49159b6059}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVNChangelogToXml", "SVNChangelogToXml.csproj", "{c6159c5e-f6ef-4a63-b152-0e49159b6059}"
EndProject EndProject
Global Global

Loading…
Cancel
Save