Skip to content

Base Subversion capability (svn:// protocol and anon only so far) #1721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions SparkleShare.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare.Windows", "Spa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare.Linux", "SparkleShare\Linux\SparkleShare.Linux.csproj", "{5714D3CA-88A6-4330-A29D-4CA90D1D193C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sparkles.Subversion", "Sparkles\Subversion\Sparkles.Subversion.csproj", "{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|Any CPU = Release|Any CPU
Expand Down Expand Up @@ -48,6 +50,12 @@ Global
{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.Release|Any CPU.Build.0 = Release|Any CPU
{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.ReleaseDist|Any CPU.ActiveCfg = ReleaseDist|Any CPU
{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.ReleaseDist|Any CPU.Build.0 = ReleaseDist|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.Release|Any CPU.Build.0 = Release|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down
1 change: 1 addition & 0 deletions SparkleShare/Common/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public virtual void Initialize ()
Logger.LogInfo ("Environment", "SparkleShare " + version);
Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion);
Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion);
Logger.LogInfo ("Environment", "Svn " + Sparkles.Subversion.SubversionCommand.SvnVersion);

// TODO: ToString() with nice os version names (Mac OS X Yosemite, Fedora 24, Ubuntu 16.04, etc.)
Logger.LogInfo ("Environment", InstallationInfo.OperatingSystem + " (" + Environment.OSVersion + ")");
Expand Down
34 changes: 34 additions & 0 deletions SparkleShare/Common/Images/Sources/Subversion-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion SparkleShare/Common/Presets/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ dist_presets_DATA = \
gitlab.xml \
own-server.xml \
planio.xml \
subversion.xml \
github.png \
gitlab.png \
bitbucket.png \
planio.png \
subversion.png \
own-server.png

presetsdir = $(pkgdatadir)/presets/

MAINTAINERCLEANFILES = \
Makefile.in

Binary file added SparkleShare/Common/Presets/subversion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions SparkleShare/Common/Presets/subversion.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<preset>
<info>
<name>Subversion Server</name>
<description>Subversion Server</description>
<icon>subversion.png</icon>
<backend>Subversion</backend>
</info>
<address>
<value/>
<example>svn://subversion.somewhere.com</example>
</address>
<path>
<value/>
<example>path/to/folder/you/want/as/root</example>
</path>
</preset>
</sparkleshare>
Binary file added SparkleShare/Common/Presets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion SparkleShare/Linux/SparkleShare.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
<Project>{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}</Project>
<Name>Sparkles.Git</Name>
</ProjectReference>
<ProjectReference Include="..\..\Sparkles\Subversion\Sparkles.Subversion.csproj">
<Project>{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}</Project>
<Name>Sparkles.Subversion</Name>
</ProjectReference>
<ProjectReference Include="..\..\Sparkles\Sparkles.csproj">
<Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project>
<Name>Sparkles</Name>
Expand Down Expand Up @@ -117,6 +121,15 @@
<None Include="..\Common\Presets\planio%402x.png">
<Link>Presets\planio%402x.png</Link>
</None>
<BundleResource Include="..\Common\Presets\subversion.png">
<Link>Presets\subversion.png</Link>
</BundleResource>
<BundleResource Include="..\Common\Presets\subversion.xml">
<Link>Presets\subversion.xml</Link>
</BundleResource>
<BundleResource Include="..\Common\Presets\subversion%402x.png">
<Link>Presets\subversion%402x.png</Link>
</BundleResource>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\Avatars.cs">
Expand Down Expand Up @@ -178,4 +191,4 @@
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
14 changes: 14 additions & 0 deletions SparkleShare/Mac/SparkleShare.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
<Profiling>false</Profiling>
<LinkMode>None</LinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseDist|AnyCPU' ">
<Optimize>false</Optimize>
Expand Down Expand Up @@ -244,6 +245,15 @@
<BundleResource Include="..\Common\Presets\planio%402x.png">
<Link>Presets\planio%402x.png</Link>
</BundleResource>
<BundleResource Include="..\Common\Presets\subversion.png">
<Link>Presets\subversion.png</Link>
</BundleResource>
<BundleResource Include="..\Common\Presets\subversion.xml">
<Link>Presets\subversion.xml</Link>
</BundleResource>
<BundleResource Include="..\Common\Presets\subversion%402x.png">
<Link>Presets\subversion%402x.png</Link>
</BundleResource>
<BundleResource Include="..\Common\Images\text-balloon.png">
<Link>Resources\text-balloon.png</Link>
</BundleResource>
Expand Down Expand Up @@ -278,5 +288,9 @@
<Project>{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}</Project>
<Name>Sparkles.Git</Name>
</ProjectReference>
<ProjectReference Include="..\..\Sparkles\Subversion\Sparkles.Subversion.csproj">
<Project>{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}</Project>
<Name>Sparkles.Subversion</Name>
</ProjectReference>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions SparkleShare/Windows/SparkleShare.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@
<Link>Presets\planio.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\Common\Presets\subversion.png">
<Link>Presets\subversion.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\Common\Presets\ssnet.xml">
Expand All @@ -241,6 +245,10 @@
<Link>Presets\planio.xml</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\Common\Presets\subversion.xml">
<Link>Presets\subversion.xml</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\folder.png" />
Expand Down
4 changes: 4 additions & 0 deletions Sparkles/BaseFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ public static string GetBackend (string address)
return char.ToUpper (backend [0]) + backend.Substring (1);
}

if (address.StartsWith ("svn", StringComparison.InvariantCultureIgnoreCase)) {
return "Subversion";
}

return "Git";
}

Expand Down
2 changes: 1 addition & 1 deletion Sparkles/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Command (string path, string args, bool write_output)

if (!string.IsNullOrEmpty (StartInfo.WorkingDirectory))
folder = Path.GetFileName (StartInfo.WorkingDirectory) + " | ";

if (write_output)
Logger.LogInfo ("Cmd", folder + Path.GetFileName (StartInfo.FileName) + " " + StartInfo.Arguments);

Expand Down
21 changes: 21 additions & 0 deletions Sparkles/Subversion/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ASSEMBLY = Sparkles.Git
TARGET = library

LINK = -r:$(DIR_BIN)/Sparkles.dll

SOURCES = \
SubversionCommand.cs \
SubversionFetcher.cs \
SubversionRepository.cs

install-data-hook:
for ASM in $(EXTRA_BUNDLE); do \
$(INSTALL) -m 0755 $$ASM $(DESTDIR)$(moduledir); \
done;

uninstall-hook:
for ASM in $(EXTRA_BUNDLE); do \
rm -f $(DESTDIR)$(moduledir)/`basename $$ASM`; \
done;

include $(top_srcdir)/build/build.mk
60 changes: 60 additions & 0 deletions Sparkles/Subversion/Sparkles.Subversion.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{009FDCD7-1D57-4202-BB6D-8477D8C6AAAA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sparkles.Subversion</RootNamespace>
<AssemblyName>Sparkles.Subversion</AssemblyName>
<FileAlignment>512</FileAlignment>
<ReleaseVersion>
</ReleaseVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>True</Optimize>
<OutputPath>..\..\bin\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<WarningLevel>4</WarningLevel>
<DefineConstants>TRACE DEBUG</DefineConstants>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include="SubversionFetcher.cs" />
<Compile Include="SubversionCommand.cs" />
<Compile Include="SubversionRepository.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sparkles.csproj">
<Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project>
<Name>Sparkles</Name>
</ProjectReference>
</ItemGroup>
</Project>
110 changes: 110 additions & 0 deletions Sparkles/Subversion/SubversionCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <[email protected]>
// Portions Copyright (C) 2016 Paul Hammant <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Globalization;
using System.Text.RegularExpressions;

namespace Sparkles.Subversion {

public class SubversionCommand : Command {

public static string ExecPath;


static string svn_path;

public static string SvnPath {
get {
if (svn_path == null)
svn_path = LocateCommand ("svn");

return svn_path;
}

set {
svn_path = value;
}
}


public static string SvnVersion {
get {
if (SvnPath == null)
SvnPath = LocateCommand ("svn");

var svn_version = new Command (SvnPath, "--version", false);

if (ExecPath != null)
svn_version.SetEnvironmentVariable ("SVN_EXEC_PATH", ExecPath);

string version = svn_version.StartAndReadStandardOutput ();
return version.Substring(0, version.IndexOf("\n")).Replace ("svn, version ", "");
}
}

public SubversionCommand (string working_dir, string args) : this (working_dir, args, null)
{
}


public SubversionCommand (string working_dir, string args, SSHAuthenticationInfo auth_info) : base (SvnPath, args)
{

StartInfo.WorkingDirectory = working_dir;

if (ExecPath != null)
SetEnvironmentVariable ("SVN_EXEC_PATH", ExecPath);

SetEnvironmentVariable ("LANG", "en_US");

}


static ErrorStatus FindError (string line)
{
ErrorStatus error = ErrorStatus.None;

if (line.Contains ("WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!") ||
line.Contains ("WARNING: POSSIBLE DNS SPOOFING DETECTED!")) {

error = ErrorStatus.HostIdentityChanged;
}

if (line.StartsWith ("Permission denied") ||
line.StartsWith ("ssh_exchange_identification: Connection closed by remote host") ||
line.StartsWith ("The authenticity of host")) {

error = ErrorStatus.AuthenticationFailed;
}

if (line.EndsWith ("does not appear to be a git repository"))
error = ErrorStatus.NotFound;

if (line.EndsWith ("expected old/new/ref, got 'shallow"))
error = ErrorStatus.IncompatibleClientServer;

if (line.StartsWith ("error: Disk space exceeded") ||
line.EndsWith ("No space left on device") ||
line.EndsWith ("file write error (Disk quota exceeded)")) {

error = ErrorStatus.DiskSpaceExceeded;
}

return error;
}
}
}
Loading