diff options
Diffstat (limited to 'main/src/addins/VersionControl/Subversion.Win32')
3 files changed, 139 insertions, 111 deletions
diff --git a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs index 667308fa8f..e7d8902ebc 100644 --- a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs +++ b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs @@ -41,14 +41,6 @@ namespace SubversionAddinWindows return new SvnSharpBackend ();
}
- public override string GetPathUrl (FilePath path)
- {
- lock (client) {
- Uri u = client.Value.GetUriFromWorkingCopy (path);
- return u != null ? u.ToString () : null;
- }
- }
-
public override bool IsInstalled
{
get
@@ -69,7 +61,8 @@ namespace SubversionAddinWindows {
string wc_path;
try {
- wc_path = client.Value.GetWorkingCopyRoot (path.FullPath);
+ lock (client.Value)
+ wc_path = client.Value.GetWorkingCopyRoot (path.FullPath);
return wc_path;
} catch (SvnException e) {
switch (e.SvnErrorCode) {
@@ -88,7 +81,7 @@ namespace SubversionAddinWindows get { return SvnSharpClient.client.Value; }
}
- IProgressMonitor updateMonitor;
+ ProgressMonitor updateMonitor;
NotifData notifyData;
ProgressData progressData;
@@ -98,7 +91,8 @@ namespace SubversionAddinWindows try {
// This outputs the contents of the base revision
// of a file to a stream.
- client.Write (new SvnPathTarget (sourcefile), data);
+ lock (client)
+ client.Write (new SvnPathTarget (sourcefile), data);
return TextFile.ReadFile (sourcefile, data).Text;
} catch (SvnIllegalTargetException e) {
// This occurs when we don't have a base file for
@@ -173,13 +167,14 @@ namespace SubversionAddinWindows SslFailure acceptedFailures;
bool save;
- var certInfo = new CertficateInfo ();
- certInfo.AsciiCert = e.CertificateValue;
- certInfo.Fingerprint = e.Fingerprint;
- certInfo.HostName = e.CommonName;
- certInfo.IssuerName = e.Issuer;
- certInfo.ValidFrom = e.ValidFrom;
- certInfo.ValidUntil = e.ValidUntil;
+ var certInfo = new CertficateInfo {
+ AsciiCert = e.CertificateValue,
+ Fingerprint = e.Fingerprint,
+ HostName = e.CommonName,
+ IssuerName = e.Issuer,
+ ValidFrom = e.ValidFrom,
+ ValidUntil = e.ValidUntil,
+ };
e.Cancel = !SslServerTrustAuthenticationPrompt (e.Realm, (SslFailure) (uint) e.Failures, e.MaySave, certInfo, out acceptedFailures, out save);
@@ -205,23 +200,25 @@ namespace SubversionAddinWindows e.CertificateFile = file;
}
- public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Add (FilePath path, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnAddArgs ();
+ var args = new SvnAddArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
lock (client)
client.Add (path, args);
}
- public override void Checkout (string url, FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
+ public override void Checkout (string url, FilePath path, Revision rev, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnCheckOutArgs ();
+ var args = new SvnCheckOutArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
lock (client) {
try {
- client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
+ client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path, args);
} catch (SvnOperationCanceledException) {
if (Directory.Exists (path.ParentDirectory))
FileService.DeleteDirectory (path.ParentDirectory);
@@ -229,20 +226,22 @@ namespace SubversionAddinWindows }
}
- public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
+ public override void Commit (FilePath[] paths, string message, ProgressMonitor monitor)
{
- var args = new SvnCommitArgs ();
+ var args = new SvnCommitArgs {
+ LogMessage = message,
+ };
BindMonitor (monitor);
- args.LogMessage = message;
lock (client)
client.Commit (paths.ToStringArray (), args);
}
- public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
+ public override void Delete (FilePath path, bool force, ProgressMonitor monitor)
{
- var args = new SvnDeleteArgs ();
+ var args = new SvnDeleteArgs {
+ Force = force,
+ };
BindMonitor (monitor);
- args.Force = force;
lock (client)
client.Delete (path, args);
}
@@ -250,7 +249,9 @@ namespace SubversionAddinWindows public override string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
{
var ms = new MemoryStream ();
- SvnUriTarget target = client.GetUriFromWorkingCopy (rootPath);
+ SvnUriTarget target;
+ lock (client)
+ target = client.GetUriFromWorkingCopy (rootPath);
// Redo path link.
repositoryPath = repositoryPath.TrimStart (new [] { '/' });
foreach (var segment in target.Uri.Segments) {
@@ -279,7 +280,8 @@ namespace SubversionAddinWindows public override string GetVersion ()
{
- return SvnClient.Version.ToString ();
+ lock (client)
+ return SvnClient.Version.ToString ();
}
public override IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev)
@@ -292,41 +294,42 @@ namespace SubversionAddinWindows return List (new SvnPathTarget (path, GetRevision (rev)), recurse);
}
- IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse)
+ static IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse)
{
var list = new List<DirectoryEntry> ();
- var args = new SvnListArgs ();
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
+ var args = new SvnListArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
lock (client)
client.List (target, args, delegate (object o, SvnListEventArgs a) {
- if (string.IsNullOrEmpty (a.Path))
- return;
- var de = new DirectoryEntry ();
- de.CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev;
- de.HasProps = a.Entry.HasProperties;
- de.IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory;
- de.LastAuthor = a.Entry.Author;
- de.Name = a.Path;
- de.Size = a.Entry.FileSize;
- de.Time = a.Entry.Time;
- list.Add (de);
- });
+ if (string.IsNullOrEmpty (a.Path))
+ return;
+ list.Add (new DirectoryEntry {
+ CreatedRevision = ToBaseRevision (a.Entry.Revision).Rev,
+ HasProps = a.Entry.HasProperties,
+ IsDirectory = a.Entry.NodeKind == SvnNodeKind.Directory,
+ LastAuthor = a.Entry.Author,
+ Name = a.Path,
+ Size = a.Entry.FileSize,
+ Time = a.Entry.Time,
+ });
+ });
return list;
}
public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd)
{
var list = new List<SvnRevision> ();
- var args = new SvnLogArgs ();
- args.Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd));
+ var args = new SvnLogArgs {
+ Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd)),
+ };
lock (client)
client.Log (path, args, delegate (object o, SvnLogEventArgs a) {
var paths = new List<RevisionPath> ();
foreach (SvnChangeItem item in a.ChangedPaths) {
paths.Add (new RevisionPath (item.Path, ConvertRevisionAction (item.Action), ""));
}
- var r = new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ());
- list.Add (r);
+ list.Add (new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ()));
});
return list;
}
@@ -342,24 +345,26 @@ namespace SubversionAddinWindows return RevisionAction.Other;
}
- public override void Mkdir (string[] paths, string message, IProgressMonitor monitor)
+ public override void Mkdir (string[] paths, string message, ProgressMonitor monitor)
{
- var args = new SvnCreateDirectoryArgs ();
- args.CreateParents = true;
+ var args = new SvnCreateDirectoryArgs {
+ CreateParents = true,
+ LogMessage = message,
+ };
BindMonitor (monitor);
var uris = new List<Uri> ();
foreach (string path in paths)
uris.Add (new Uri (path));
- args.LogMessage = message;
lock (client)
client.RemoteCreateDirectories (uris, args);
}
- public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor)
+ public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor)
{
- var args = new SvnMoveArgs ();
+ var args = new SvnMoveArgs {
+ Force = force,
+ };
BindMonitor (monitor);
- args.Force = force;
lock (client)
client.Move (srcPath, destPath, args);
}
@@ -368,27 +373,30 @@ namespace SubversionAddinWindows {
var t1 = new SvnPathTarget (path1, GetRevision (revision1));
var t2 = new SvnPathTarget (path2, GetRevision (revision2));
- var args = new SvnDiffArgs ();
- args.Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children;
- var ms = new MemoryStream ();
- lock (client)
- client.Diff (t1, t2, args, ms);
- ms.Position = 0;
- using (var sr = new StreamReader (ms)) {
- return sr.ReadToEnd ();
+ var args = new SvnDiffArgs {
+ Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children,
+ };
+ using (var ms = new MemoryStream ()) {
+ lock (client)
+ client.Diff (t1, t2, args, ms);
+ ms.Position = 0;
+ using (var sr = new StreamReader (ms)) {
+ return sr.ReadToEnd ();
+ }
}
}
- public override void Revert (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ public override void Revert (FilePath[] paths, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnRevertArgs ();
+ var args = new SvnRevertArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
lock (client)
client.Revert (paths.ToStringArray (), args);
}
- public override void RevertRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
var args = new SvnMergeArgs ();
BindMonitor (monitor);
@@ -398,7 +406,7 @@ namespace SubversionAddinWindows client.Merge (path, new SvnPathTarget (path), range, args);
}
- public override void RevertToRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ public override void RevertToRevision (FilePath path, Revision revision, ProgressMonitor monitor)
{
var args = new SvnMergeArgs ();
BindMonitor (monitor);
@@ -410,11 +418,12 @@ namespace SubversionAddinWindows public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus)
{
var list = new List<VersionInfo> ();
- var args = new SvnStatusArgs ();
- args.Revision = GetRevision (revision);
- args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children;
- args.RetrieveAllEntries = !changedItemsOnly;
- args.RetrieveRemoteStatus = remoteStatus;
+ var args = new SvnStatusArgs {
+ Revision = GetRevision (revision),
+ Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children,
+ RetrieveAllEntries = !changedItemsOnly,
+ RetrieveRemoteStatus = remoteStatus,
+ };
lock (client) {
try {
client.Status (path, args, (o, a) => list.Add (CreateVersionInfo (repo, a)));
@@ -497,31 +506,35 @@ namespace SubversionAddinWindows return VersionStatus.Unversioned;
}
- public override void Lock (IProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
+ public override void Lock (ProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
{
- var args = new SvnLockArgs ();
+ var args = new SvnLockArgs {
+ Comment = comment,
+ StealLock = stealLock,
+ };
BindMonitor (monitor);
- args.Comment = comment;
- args.StealLock = stealLock;
lock (client)
client.Lock (paths.ToStringArray (), args);
}
- public override void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths)
+ public override void Unlock (ProgressMonitor monitor, bool breakLock, params FilePath[] paths)
{
- var args = new SvnUnlockArgs ();
+ var args = new SvnUnlockArgs {
+ BreakLock = breakLock,
+ };
BindMonitor (monitor);
- args.BreakLock = breakLock;
lock (client)
client.Unlock (paths.ToStringArray (), args);
}
- public override void Update (FilePath path, bool recurse, IProgressMonitor monitor)
+ public override void Update (FilePath path, bool recurse, ProgressMonitor monitor)
{
- var args = new SvnUpdateArgs ();
+ var args = new SvnUpdateArgs {
+ Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children,
+ };
BindMonitor (monitor);
- args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
- client.Update (path, args);
+ lock (client)
+ client.Update (path, args);
}
public override void Ignore (FilePath[] paths)
@@ -556,22 +569,29 @@ namespace SubversionAddinWindows throw new ArgumentNullException ();
var target = new SvnPathTarget (file, SharpSvn.SvnRevision.Base);
- var data = new MemoryStream ();
int numAnnotations = 0;
- client.Write (target, data);
-
- using (var reader = new StreamReader (data)) {
- reader.BaseStream.Seek (0, SeekOrigin.Begin);
- while (reader.ReadLine () != null)
- numAnnotations++;
+ using (var data = new MemoryStream ()) {
+ lock (client)
+ client.Write (target, data);
+
+ using (var reader = new StreamReader (data)) {
+ reader.BaseStream.Seek (0, SeekOrigin.Begin);
+ while (reader.ReadLine () != null)
+ numAnnotations++;
+ }
}
System.Collections.ObjectModel.Collection<SvnBlameEventArgs> list;
- var args = new SvnBlameArgs ();
- args.Start = GetRevision (revStart);
- args.End = GetRevision (revEnd);
+ var args = new SvnBlameArgs {
+ Start = GetRevision (revStart),
+ End = GetRevision (revEnd),
+ };
- if (client.GetBlame (target, args, out list)) {
+ bool success;
+ lock (client) {
+ success = client.GetBlame (target, args, out list);
+ }
+ if (success) {
var annotations = new Annotation [numAnnotations];
foreach (var annotation in list) {
if (annotation.LineNumber < annotations.Length)
@@ -633,7 +653,7 @@ namespace SubversionAddinWindows public int Seconds;
}
- void BindMonitor (IProgressMonitor monitor)
+ void BindMonitor (ProgressMonitor monitor)
{
notifyData = new NotifData ();
progressData = new ProgressData ();
@@ -648,7 +668,7 @@ namespace SubversionAddinWindows return String.Format ("{0:0.00} MBytes", kbytes / 1024.0);
}
- static void ProgressWork (SvnProgressEventArgs e, ProgressData data, IProgressMonitor monitor)
+ static void ProgressWork (SvnProgressEventArgs e, ProgressData data, ProgressMonitor monitor)
{
if (monitor == null)
return;
@@ -685,7 +705,7 @@ namespace SubversionAddinWindows data.LogTimer.Start ();
}
- static void Notify (SvnNotifyEventArgs e, NotifData notifData, IProgressMonitor monitor)
+ static void Notify (SvnNotifyEventArgs e, NotifData notifData, ProgressMonitor monitor)
{
string actiondesc;
string file = e.Path;
diff --git a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj index d635660a89..5a78c6eb76 100644 --- a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj +++ b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj @@ -59,8 +59,11 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> - <Reference Include="SharpSvn, Version=1.8005.2778.15501, Culture=neutral, PublicKeyToken=d729672594885a28"> - <HintPath>..\..\..\..\external\sharpsvn-binary\SharpSvn.dll</HintPath> + <Reference Include="SharpSvn"> + <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn.dll</HintPath> + </Reference> + <Reference Include="SharpSvn.UI"> + <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn.UI.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> @@ -89,13 +92,13 @@ </BootstrapperPackage> </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"> + <PropertyGroup> + <NuGet>$(SolutionDir)\external\nuget-binary\NuGet.exe</NuGet> + <NuGet Condition="$(OS)=='Unix'">mono $(NuGet)</NuGet> + </PropertyGroup> + <Exec Command="$(NuGet) restore -SolutionDirectory $(SolutionDir)" /> </Target> - <Target Name="AfterBuild"> - </Target> - --> <ItemGroup> <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj"> <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project> @@ -124,13 +127,14 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="..\..\..\..\external\sharpsvn-binary\SharpPlink-Win32.svnExe"> + <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpPlink-Win32.svnExe"> <Link>SharpPlink-Win32.svnExe</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="..\..\..\..\external\sharpsvn-binary\SharpSvn-DB44-20-win32.svnDll"> + <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8010.3345.53\lib\net40\SharpSvn-DB44-20-win32.svnDll"> <Link>SharpSvn-DB44-20-win32.svnDll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="packages.config" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/main/src/addins/VersionControl/Subversion.Win32/packages.config b/main/src/addins/VersionControl/Subversion.Win32/packages.config new file mode 100644 index 0000000000..eead751a62 --- /dev/null +++ b/main/src/addins/VersionControl/Subversion.Win32/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="SharpSvn.1.8-x86" version="1.8010.3345.53" targetFramework="net40" />
+</packages>
\ No newline at end of file |