SvnExporter.Lib 1.0.0

dotnet add package SvnExporter.Lib --version 1.0.0                
NuGet\Install-Package SvnExporter.Lib -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SvnExporter.Lib" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SvnExporter.Lib --version 1.0.0                
#r "nuget: SvnExporter.Lib, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SvnExporter.Lib as a Cake Addin
#addin nuget:?package=SvnExporter.Lib&version=1.0.0

// Install SvnExporter.Lib as a Cake Tool
#tool nuget:?package=SvnExporter.Lib&version=1.0.0                

SvnExporter

NuGet Package License
GitHub Organization

SvnExporter is a .NET library and tool designed to extract and export data from Subversion (SVN) repositories. It provides a flexible way to retrieve SVN log entries, including commit details, changed paths, file content (optional), and revision properties. This tool is useful for analyzing SVN history, generating reports, or as a building block for more complex SVN to Git migration processes.

Key Features

  • Flexible Log Retrieval:
    • Retrieves SVN log entries in batches for efficient processing of large repositories.
    • Allows specifying start and end revisions for targeted data extraction.
    • Tracks progress and estimates remaining time during log retrieval.
  • Detailed Revision Information:
    • Extracts author, commit date, and commit message for each revision.
    • Optionally includes lists of changed paths within each revision.
    • Optionally retrieves revision properties (beyond standard SVN metadata).
  • File Content Handling (Optional):
    • Provides options to include file content in the exported data:
      • None: No file content is retrieved (fastest, minimal data).
      • Preview: Retrieves a preview (first N characters/bytes) of file content.
      • Full: Retrieves the entire file content.
    • Detects binary files based on svn:mime-type property.
    • Handles both text and binary file content appropriately.
  • Extensible Exporting:
    • Provides an ISvnItemsExporter interface for defining custom export formats.
    • Includes example exporters:
      • Console Exporter: Displays SVN data in the console (with optional content preview).
      • Authors List Exporter: Generates a list of authors from the SVN log.

    Note: Not included into this project, see SvnRepo2Git project.

    • Svn2Git Exporter (Integration): Designed to be used as a component in SVN to Git conversion tool.
  • Options for Data Inclusion:
    • Fine-grained control over what data to retrieve using LogRetrievalOptions:
      • FileContentMode: Control the level of file content retrieval (None, Preview, Full).
      • IncludeChangedPaths: Include lists of changed files/directories in each revision.
      • IncludeRevisionProperties: Include custom revision properties.
  • Uses SharpSvn: Built on the robust and well-regarded SharpSvn library for interacting with SVN repositories.

Getting Started

Prerequisites

  • .NET Runtime: Ensure you have a compatible .NET runtime installed (e.g., .NET 9 or later).
  • SharpSvn: SvnExporter relies on the SharpSvn library. This is typically managed through NuGet package manager when building the project.
  • SVN Client (Optional): While SvnExporter uses SharpSvn, having a standard SVN client installed might be helpful for troubleshooting or interacting with SVN repositories outside of this tool.

Installation

You can install SvnExporter using NuGet:

dotnet add package SvnExporter.Lib

Note: The package ID has been changed to SvnExporter.Lib to avoid conflicts with an existing package.

Building the Project

  1. Clone the Repository:

    git clone https://github.com/Svn2GitTools/SvnExporter.git  # Replace with your actual repository URL
    cd SvnExporter
    
  2. Build with .NET CLI:

    dotnet build
    

    or open the project in Visual Studio or your preferred .NET IDE and build.

Usage

SvnExporter is primarily a library, but it can be used with example console applications (like those shown in your code snippets) or integrated into other tools.

Example Usage:

// ... (Project setup and dependencies) ...

ISvnItemsReader itemsReader = new SvnItemsReader();

// Example 1: Console Output with Preview Content
LogRetrievalOptions consoleOptions = new LogRetrievalOptions()
{
    FileContentMode = EFileContentMode.Preview,
    FileContentPreviewLength = 100,
    IncludeChangedPaths = true,
    IncludeRevisionProperties = true
};
Console.WriteLine("--- Console Display Output (Preview Content) ---");
IEnumerable<SvnRevision> logEntriesForConsole = itemsReader.GetLogEntries("your_svn_repo_url", consoleOptions); // Replace with your SVN URL
ISvnItemsExporter consoleExporter = new ConsoleSvnItemsExporter();
consoleExporter.Export(logEntriesForConsole);


// Example 2: Generating Author List
LogRetrievalOptions authorListOptions = new LogRetrievalOptions()
{
    FileContentMode = EFileContentMode.None,
    IncludeChangedPaths = false,
    IncludeRevisionProperties = false
};
Console.WriteLine("\n--- Author List Output ---");
AuthorsListExporter authorsListExporter = new AuthorsListExporter();
IEnumerable<SvnRevision> logEntriesForAuthors = itemsReader.GetLogEntries("your_svn_repo_url", authorListOptions); // Replace with your SVN URL
authorsListExporter.Export(logEntriesForAuthors);
authorsListExporter.WriteToFile("authors.txt", "yourdomain.com"); // Replace with your domain if needed


// Example 3: (Integration with Svn2GitExporter - for Git migration tools)
// ... (Setup AuthorsListImporter if needed) ...
ISvnItemsExporter gitExporter = new Svn2GitExporter("path_to_your_git_repo", /* authorsListImporter if needed */ null); // Replace with your Git repo path
LogRetrievalOptions gitExportOptions = new LogRetrievalOptions()
{
    FileContentMode = EFileContentMode.Full,
    IncludeChangedPaths = true,
    IncludeRevisionProperties = true
};
Console.WriteLine("\n--- Git Export Output (Full Content - for Git migration) ---");
IEnumerable<SvnRevision> logEntriesForGit = itemsReader.GetLogEntries("your_svn_repo_url", gitExportOptions); // Replace with your SVN URL
gitExporter.Export(logEntriesForGit);

Important:

  • Replace Placeholders: Remember to replace "your_svn_repo_url", "path_to_your_git_repo", and "yourdomain.com" with your actual SVN repository URL, Git repository path (if applicable), and email domain if using the author list exporter.
  • Command-line Interface (CLI): To make this a truly usable tool, you would typically create a command-line interface (CLI) application that takes parameters like SVN URL, output format, options, etc. This README focuses on the library aspects.

Code Structure

  • ISvnItemsReader.cs / SvnItemsReader.cs: Defines the interface and implementation for reading SVN log entries using SharpSvn. Handles batch processing, progress tracking, and conversion of SvnLogEventArgs to SvnRevision models.
  • ISvnItemsExporter.cs: Defines the interface for exporting SvnRevision data.
  • ConsoleSvnItemsExporter.cs (Example): Implements ISvnItemsExporter to display SvnRevision data in the console.
  • AuthorsListExporter.cs (Example): Implements ISvnItemsExporter to generate a list of authors from SvnRevision data.
  • Models/ Directory: Contains data models:
    • SvnRevision.cs: Represents an SVN revision with author, date, commit message, changed paths, and properties.
    • SvnChangeInfo.cs: Represents information about a changed path within a revision.
    • FileInfoDetail.cs: Represents details about a file (size, type, content).
  • LogRetrievalOptions.cs: Defines options to control what data is retrieved from SVN (content mode, changed paths, properties).

Dependencies

Contributing

Contributions are welcome! Please feel free to submit issues, bug reports, feature requests, or pull requests to improve SvnExporter.

License

This project is licensed under the MIT License - see the LICENSE file for details.


← Back to Svn to Git Tools Collection

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 101 2/25/2025