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

73
src/Tools/SVNChangeLogToXml/Main.cs

@ -7,8 +7,8 @@ using System.Xml.Xsl; @@ -7,8 +7,8 @@ using System.Xml.Xsl;
using System.Reflection;
using System.Windows.Forms;
using System.IO;
using NSvn.Common;
using NSvn.Core;
using PumaCode.SvnDotNet.AprSharp;
using PumaCode.SvnDotNet.SubversionSharp;
class MainClass
{
@ -51,7 +51,22 @@ class MainClass @@ -51,7 +51,22 @@ class MainClass
static void CreateRevisionFile()
{
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);
using (StreamWriter writer = new StreamWriter("../REVISION")) {
writer.Write(rev.ToString());
@ -62,28 +77,38 @@ class MainClass @@ -62,28 +77,38 @@ class MainClass
{
Console.WriteLine("Reading SVN changelog, this might take a while...");
Client client = new Client();
client.AuthBaton.Add(AuthenticationProvider.GetUsernameProvider());
client.AuthBaton.Add(AuthenticationProvider.GetSimpleProvider());
client.AuthBaton.Add(AuthenticationProvider.GetSimplePromptProvider(PasswordPrompt, 3));
SvnClient client = new SvnClient();
client.AddUsernameProvider();
client.AddSimpleProvider();
client.OpenAuth();
StringWriter writer = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(writer);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("log");
client.Log(new string[] {".."}, Revision.Base, Revision.FromNumber(startRevision), false, false,
delegate(LogMessage message) {
xmlWriter.WriteStartElement("logentry");
xmlWriter.WriteAttributeString("revision", message.Revision.ToString(System.Globalization.CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("author", message.Author);
xmlWriter.WriteElementString("date", message.Date.ToString("MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture));
xmlWriter.WriteElementString("msg", message.Message);
xmlWriter.WriteEndElement();
});
int progressCount = 0;
client.Log2(
new SvnPath[] { new SvnPath("..", client.Pool)},
Svn.Revision.Base, new SvnRevision(startRevision),
int.MaxValue, false, false,
delegate(IntPtr baton, AprHash changed_paths, int revision, AprString author, AprString date, AprString message, AprPool pool) {
if (++progressCount == 10) {
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();
//Console.WriteLine(writer);
Console.WriteLine();
XmlTextReader input = new XmlTextReader(new StringReader(writer.ToString()));
@ -96,17 +121,9 @@ class MainClass @@ -96,17 +121,9 @@ class MainClass
xsl.Transform(input, xmlWriter);
xmlWriter.Close();
tw.Close();
client.GlobalPool.Destroy();
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 @@ @@ -38,48 +38,52 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<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.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<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>
<Compile Include="Main.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LIBAPR.DLL">
<Link>LIBAPR.DLL</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibAprIconv.Dll">
<Link>LibAprIconv.Dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibAprUtil.Dll">
<Link>LibAprUtil.Dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\msvcp70.dll">
<Link>msvcp70.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\LibDB44.dll">
<Link>LibDB44.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\msvcr70.dll">
<Link>msvcr70.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\intl3_svn.dll">
<Link>intl3_svn.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libapr.dll">
<Link>libapr.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libapriconv.dll">
<Link>libapriconv.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libaprutil.dll">
<Link>libaprutil.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libdb44.dll">
<Link>libdb44.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\libeay32.dll">
<Link>libeay32.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\AddIns\Misc\SubversionAddIn\RequiredLibraries\ssleay32.dll">
<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>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

6
src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln

@ -1,5 +1,7 @@ @@ -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}"
EndProject
Global

Loading…
Cancel
Save