Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan McGovern <alan@xamarin.com>2013-08-14 22:15:32 +0400
committerAlan McGovern <alan@xamarin.com>2013-08-14 22:16:05 +0400
commit3fad1799061bc2f883119706fec030feefe54865 (patch)
treea4e1cd54d552197668c9babd8153fe7e1a6a6b32 /main/src/addins/VersionControl/Subversion.Win32
parentf5ef5df4773afbf437719289e52325ef3db83668 (diff)
[build] Move around some stuff to shorten paths
Diffstat (limited to 'main/src/addins/VersionControl/Subversion.Win32')
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/Manifest.addin.xml40
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/Properties/AssemblyInfo.cs35
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs724
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj137
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/subversion-logo.pngbin0 -> 1511 bytes
5 files changed, 936 insertions, 0 deletions
diff --git a/main/src/addins/VersionControl/Subversion.Win32/Manifest.addin.xml b/main/src/addins/VersionControl/Subversion.Win32/Manifest.addin.xml
new file mode 100644
index 0000000000..57fa8a8d80
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/Manifest.addin.xml
@@ -0,0 +1,40 @@
+<Addin id = "SubversionAddinWindows"
+ namespace = "MonoDevelop"
+ version = "4.1.7">
+ <Header>
+ <Name>Subversion Add-in</Name>
+ <Description>Subversion support for the Version Control Add-in</Description>
+ <Description locale="ca">Suport per a Subversion</Description>
+ <Icon32>subversion-logo.png</Icon32>
+ <Author>Lluis Sanchez</Author>
+ <Copyright>GPL</Copyright>
+ <Category>Version Control</Category>
+ </Header>
+
+ <Dependencies>
+ <Addin id="Core" version="4.1.7"/>
+ <Addin id="Ide" version="4.1.7"/>
+ <Addin id="VersionControl" version="4.1.7"/>
+ <Addin id="VersionControl.Subversion" version="4.1.7"/>
+ </Dependencies>
+
+ <!-- Some files are excluded twice. This is on purpose to work around some case sensivity issues. If you change this you break addin installation on windows -->
+ <Runtime>
+ <Import file="SharpSvn.dll" />
+ <ScanExclude path="SharpSvn.dll"/>
+ <Import file="SharpPlink-Win32.svnExe" />
+ <ScanExclude path="SharpPlink-Win32.svnExe" />
+ <Import file="SharpSvn-DB44-20-win32.dll" />
+ <ScanExclude path="SharpSvn-DB44-20-win32.dll" />
+ <ScanExclude path="SharpSvn-DB44-20-Win32.dll" />
+ <Import file="SharpSvn-Sasl21-23-win32.dll" />
+ <ScanExclude path="SharpSvn-Sasl21-23-win32.dll" />
+ <ScanExclude path="SharpSvn-Sasl21-23-Win32.dll" />
+ <ScanExclude path="SharpSvn-SASL21-23-win32.dll" />
+ <ScanExclude path="SharpSvn-SASL21-23-Win32.dll" />
+ </Runtime>
+
+ <Extension path = "/MonoDevelop/VersionControl/VersionControlSystems">
+ <Class class = "SubversionAddinWindows.SvnSharpClient" />
+ </Extension>
+</Addin>
diff --git a/main/src/addins/VersionControl/Subversion.Win32/Properties/AssemblyInfo.cs b/main/src/addins/VersionControl/Subversion.Win32/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..505b31fdc7
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle ("SubversionAddinWindows")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("SubversionAddinWindows")]
+[assembly: AssemblyCopyright ("Copyright © Xamarin Inc. 2013")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible (false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid ("b4d7cf3f-125f-42bf-9484-3526e6c638a0")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: AssemblyFileVersion ("1.0.0.0")]
diff --git a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
new file mode 100644
index 0000000000..dd357a428a
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
@@ -0,0 +1,724 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using MonoDevelop.Core;
+using MonoDevelop.VersionControl;
+using MonoDevelop.VersionControl.Subversion;
+using SharpSvn;
+using SharpSvn.Security;
+using SvnRevision = MonoDevelop.VersionControl.Subversion.SvnRevision;
+using MonoDevelop.Ide;
+using MonoDevelop.Projects.Text;
+
+namespace SubversionAddinWindows
+{
+ public class SvnSharpClient: SubversionVersionControl
+ {
+ static bool errorShown;
+ static bool installError;
+ static SvnClient client;
+
+ static SvnSharpClient ()
+ {
+ try {
+ client = new SvnClient ();
+ } catch (Exception ex) {
+ LoggingService.LogError ("SVN client could not be initialized", ex);
+ installError = true;
+ }
+ }
+
+ public override SubversionBackend CreateBackend ()
+ {
+ return new SvnSharpBackend ();
+ }
+
+ public override string GetPathUrl (FilePath path)
+ {
+ lock (client) {
+ Uri u = client.GetUriFromWorkingCopy (path);
+ return u != null ? u.ToString () : null;
+ }
+ }
+
+ public override bool IsInstalled
+ {
+ get
+ {
+ if (!errorShown && installError) {
+ errorShown = true;
+ AlertButton db = new AlertButton ("Go to Download Page");
+ AlertButton res = MessageService.AskQuestion ("The Subversion add-in could not be initialized", "This add-in requires the 'Microsoft Visual C++ 2005 Service Pack 1 Redistributable'. You may need to install it.", db, AlertButton.Ok);
+ if (res == db) {
+ DesktopService.ShowUrl ("http://www.microsoft.com/downloads/details.aspx?familyid=766a6af7-ec73-40ff-b072-9112bab119c2");
+ }
+ }
+ return !installError;
+ }
+ }
+
+ public override string GetDirectoryDotSvn (FilePath path)
+ {
+ string wc_path;
+ try {
+ wc_path = client.GetWorkingCopyRoot (path.FullPath);
+ return wc_path;
+ } catch (SvnException e) {
+ switch (e.SvnErrorCode) {
+ case SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY:
+ case SvnErrorCode.SVN_ERR_WC_NOT_FILE:
+ return "";
+ }
+ throw;
+ }
+ }
+ }
+
+ public class SvnSharpBackend: SubversionBackend
+ {
+ SvnClient client;
+
+ public override string GetTextBase (string file)
+ {
+ MemoryStream data = new MemoryStream ();
+ try {
+ // This outputs the contents of the base revision
+ // of a file to a stream.
+ client.Write (new SvnPathTarget (file), data);
+ return TextFile.ReadFile (file, data).Text;
+ } catch (SvnIllegalTargetException e) {
+ // This occurs when we don't have a base file for
+ // the target file. We have no way of knowing if
+ // a file has a base version therefore this will do.
+ if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_ILLEGAL_TARGET)
+ return String.Empty;
+ throw;
+ }
+ }
+
+ public SvnSharpBackend ()
+ {
+ Init ();
+ }
+
+ void Init ()
+ {
+ client = new SvnClient ();
+ client.Authentication.SslClientCertificateHandlers += new EventHandler<SvnSslClientCertificateEventArgs> (AuthenticationSslClientCertificateHandlers);
+ client.Authentication.SslClientCertificatePasswordHandlers += new EventHandler<SvnSslClientCertificatePasswordEventArgs> (AuthenticationSslClientCertificatePasswordHandlers);
+ client.Authentication.SslServerTrustHandlers += new EventHandler<SvnSslServerTrustEventArgs> (AuthenticationSslServerTrustHandlers);
+ client.Authentication.UserNameHandlers += new EventHandler<SvnUserNameEventArgs> (AuthenticationUserNameHandlers);
+ client.Authentication.UserNamePasswordHandlers += new EventHandler<SvnUserNamePasswordEventArgs> (AuthenticationUserNamePasswordHandlers);
+ }
+
+ void AuthenticationUserNamePasswordHandlers (object sender, SvnUserNamePasswordEventArgs e)
+ {
+ string user = e.UserName;
+ string password;
+ bool save;
+ e.Cancel = !SimpleAuthenticationPrompt (e.Realm, e.MaySave, ref user, out password, out save);
+ e.UserName = user;
+ e.Password = password;
+ e.Save = save;
+ }
+
+ void AuthenticationUserNameHandlers (object sender, SvnUserNameEventArgs e)
+ {
+ string name = e.UserName;
+ bool save;
+ e.Cancel = !UserNameAuthenticationPrompt (e.Realm, e.MaySave, ref name, out save);
+ e.UserName = name;
+ e.Save = save;
+ }
+
+ void AuthenticationSslServerTrustHandlers (object sender, SvnSslServerTrustEventArgs e)
+ {
+ SslFailure acceptedFailures;
+ bool save;
+
+ CertficateInfo 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;
+
+ e.Cancel = !SslServerTrustAuthenticationPrompt (e.Realm, (SslFailure) (uint) e.Failures, e.MaySave, certInfo, out acceptedFailures, out save);
+
+ e.AcceptedFailures = (SvnCertificateTrustFailures) (int) acceptedFailures;
+ e.Save = save;
+ }
+
+ void AuthenticationSslClientCertificatePasswordHandlers (object sender, SvnSslClientCertificatePasswordEventArgs e)
+ {
+ string password;
+ bool save;
+ e.Cancel = !SslClientCertPwAuthenticationPrompt (e.Realm, e.MaySave, out password, out save);
+ e.Password = password;
+ e.Save = save;
+ }
+
+ void AuthenticationSslClientCertificateHandlers (object sender, SvnSslClientCertificateEventArgs e)
+ {
+ string file;
+ bool save;
+ e.Cancel = !SslClientCertAuthenticationPrompt (e.Realm, e.MaySave, out file, out save);
+ e.Save = save;
+ e.CertificateFile = file;
+ }
+
+ public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
+ {
+ SvnAddArgs args = new SvnAddArgs ();
+ BindMonitor (args, 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)
+ {
+ SvnCheckOutArgs args = new SvnCheckOutArgs ();
+ BindMonitor (args, monitor);
+ args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
+ lock (client)
+ client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
+ }
+
+ public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
+ {
+ SvnCommitArgs args = new SvnCommitArgs ();
+ BindMonitor (args, monitor);
+ args.LogMessage = message;
+ lock (client)
+ client.Commit (paths.ToStringArray (), args);
+ }
+
+ public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
+ {
+ SvnDeleteArgs args = new SvnDeleteArgs ();
+ BindMonitor (args, monitor);
+ args.Force = force;
+ lock (client)
+ client.Delete (path, args);
+ }
+
+ [Obsolete ("")]
+ public override string GetTextAtRevision (string repositoryPath, Revision revision)
+ {
+ return null;
+ }
+
+ public override string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
+ {
+ MemoryStream ms = new MemoryStream ();
+ SvnUriTarget target = client.GetUriFromWorkingCopy (rootPath);
+ // Redo path link.
+ repositoryPath = repositoryPath.TrimStart (new char[] { '/' });
+ foreach (var segment in target.Uri.Segments) {
+ if (repositoryPath.StartsWith (segment))
+ repositoryPath = repositoryPath.Remove (0, segment.Length);
+ }
+
+ lock (client) {
+ // repositoryPath already contains the relative URL path.
+ try {
+ client.Write (new SvnUriTarget (target.Uri.AbsoluteUri + repositoryPath, GetRevision (revision)), ms);
+ } catch (SvnFileSystemException e) {
+ // File got added/deleted at some point.
+ if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_FS_NOT_FOUND)
+ return "";
+ throw;
+ } catch (SvnClientNodeKindException e) {
+ // We're trying on a directory.
+ if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_CLIENT_IS_DIRECTORY)
+ return "";
+ throw;
+ }
+ }
+ return TextFile.ReadFile (repositoryPath, ms).Text;
+ }
+
+ public override string GetVersion ()
+ {
+ return SvnClient.Version.ToString ();
+ }
+
+ public override IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev)
+ {
+ return List (new SvnUriTarget (url, GetRevision (rev)), recurse);
+ }
+
+ public override IEnumerable<DirectoryEntry> List (FilePath path, bool recurse, SvnRevision rev)
+ {
+ return List (new SvnPathTarget (path, GetRevision (rev)), recurse);
+ }
+
+ IEnumerable<DirectoryEntry> List (SvnTarget target, bool recurse)
+ {
+ List<DirectoryEntry> list = new List<DirectoryEntry> ();
+ SvnListArgs args = new SvnListArgs ();
+ args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
+ lock (client)
+ client.List (target, args, delegate (object o, SvnListEventArgs a) {
+ if (string.IsNullOrEmpty (a.Path))
+ return;
+ DirectoryEntry 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);
+ });
+ return list;
+ }
+
+ public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd)
+ {
+ List<SvnRevision> list = new List<SvnRevision> ();
+ SvnLogArgs args = new SvnLogArgs ();
+ args.Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd));
+ lock (client)
+ client.Log (path, args, delegate (object o, SvnLogEventArgs a) {
+ List<RevisionPath> paths = new List<RevisionPath> ();
+ foreach (SvnChangeItem item in a.ChangedPaths) {
+ paths.Add (new RevisionPath (item.Path, ConvertRevisionAction (item.Action), ""));
+ }
+ SvnRevision r = new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ());
+ list.Add (r);
+ });
+ return list;
+ }
+
+ private RevisionAction ConvertRevisionAction (SvnChangeAction svnChangeAction)
+ {
+ switch (svnChangeAction) {
+ case SvnChangeAction.Add: return RevisionAction.Add;
+ case SvnChangeAction.Delete: return RevisionAction.Delete;
+ case SvnChangeAction.Modify: return RevisionAction.Modify;
+ case SvnChangeAction.Replace: return RevisionAction.Replace;
+ }
+ return RevisionAction.Other;
+ }
+
+ public override void Mkdir (string[] paths, string message, IProgressMonitor monitor)
+ {
+ SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs ();
+ args.CreateParents = true;
+ BindMonitor (args, monitor);
+ List<Uri> 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)
+ {
+ SvnMoveArgs args = new SvnMoveArgs ();
+ BindMonitor (args, monitor);
+ args.Force = force;
+ lock (client)
+ client.Move (srcPath, destPath, args);
+ }
+
+ public override string GetUnifiedDiff (FilePath path1, SvnRevision revision1, FilePath path2, SvnRevision revision2, bool recursive)
+ {
+ SvnPathTarget t1 = new SvnPathTarget (path1, GetRevision (revision1));
+ SvnPathTarget t2 = new SvnPathTarget (path2, GetRevision (revision2));
+ SvnDiffArgs args = new SvnDiffArgs ();
+ args.Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children;
+ MemoryStream ms = new MemoryStream ();
+ lock (client)
+ client.Diff (t1, t2, args, ms);
+ ms.Position = 0;
+ using (StreamReader sr = new StreamReader (ms)) {
+ return sr.ReadToEnd ();
+ }
+ }
+
+ public override void Resolve (FilePath path, bool recurse, IProgressMonitor monitor)
+ {
+ SvnResolveArgs args = new SvnResolveArgs ();
+ BindMonitor (args, monitor);
+ args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
+ lock (client)
+ client.Resolve (path, SvnAccept.MineFull, args);
+ }
+
+ public override void Revert (FilePath[] paths, bool recurse, IProgressMonitor monitor)
+ {
+ SvnRevertArgs args = new SvnRevertArgs ();
+ BindMonitor (args, 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)
+ {
+ SvnMergeArgs args = new SvnMergeArgs ();
+ BindMonitor (args, monitor);
+ Revision prev = ((SvnRevision) revision).GetPrevious ();
+ SvnRevisionRange range = new SvnRevisionRange (GetRevision (revision), GetRevision (prev));
+ lock (client)
+ client.Merge (path, new SvnPathTarget (path), range, args);
+ }
+
+ public override void RevertToRevision (FilePath path, Revision revision, IProgressMonitor monitor)
+ {
+ SvnMergeArgs args = new SvnMergeArgs ();
+ BindMonitor (args, monitor);
+ SvnRevisionRange range = new SvnRevisionRange (GetRevision (SvnRevision.Head), GetRevision (revision));
+ lock (client)
+ client.Merge (path, new SvnPathTarget (path), range, args);
+ }
+
+ public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus)
+ {
+ List<VersionInfo> list = new List<VersionInfo> ();
+ SvnStatusArgs args = new SvnStatusArgs ();
+ args.Revision = GetRevision (revision);
+ args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children;
+ args.RetrieveAllEntries = !changedItemsOnly;
+ args.RetrieveRemoteStatus = remoteStatus;
+ lock (client)
+ client.Status (path, args, delegate (object o, SvnStatusEventArgs a) {
+ list.Add (CreateVersionInfo (repo, a));
+ });
+ return list;
+ }
+
+ VersionInfo CreateVersionInfo (Repository repo, SvnStatusEventArgs ent)
+ {
+ VersionStatus rs = VersionStatus.Unversioned;
+ Revision rr = null;
+
+ // TODO: Fix remote status for Win32 Svn.
+ if (ent.IsRemoteUpdated) {
+ rs = ConvertStatus (SvnSchedule.Normal, ent.RemoteContentStatus);
+ rr = new SvnRevision (repo, (int) ent.RemoteUpdateRevision, ent.RemoteUpdateCommitTime,
+ ent.RemoteUpdateCommitAuthor, "(unavailable)", null);
+ }
+
+ SvnSchedule sched = ent.WorkingCopyInfo != null ? ent.WorkingCopyInfo.Schedule : SvnSchedule.Normal;
+ VersionStatus status = ConvertStatus (sched, ent.LocalContentStatus);
+
+ bool readOnly = File.Exists (ent.FullPath) && (File.GetAttributes (ent.FullPath) & FileAttributes.ReadOnly) != 0;
+
+ if (ent.WorkingCopyInfo != null) {
+ if (ent.RemoteLock != null || ent.WorkingCopyInfo.LockToken != null) {
+ status |= VersionStatus.LockRequired;
+ if (ent.WorkingCopyInfo.LockToken != null || (ent.RemoteLock != null && ent.RemoteLock.Token != null))
+ status |= VersionStatus.LockOwned;
+ else
+ status |= VersionStatus.Locked;
+ }
+ else if (readOnly)
+ status |= VersionStatus.LockRequired;
+ }
+
+ string repoPath = ent.Uri != null ? ent.Uri.ToString () : null;
+ SvnRevision newRev = null;
+ if (ent.WorkingCopyInfo != null)
+ newRev = new SvnRevision (repo, (int) ent.WorkingCopyInfo.Revision);
+
+ VersionInfo ret = new VersionInfo (ent.FullPath, repoPath, ent.NodeKind == SvnNodeKind.Directory,
+ status, newRev,
+ rs, rr);
+ return ret;
+ }
+
+ private VersionStatus ConvertStatus (SvnSchedule schedule, SvnStatus status)
+ {
+ switch (schedule) {
+ case SvnSchedule.Add: return VersionStatus.Versioned | VersionStatus.ScheduledAdd;
+ case SvnSchedule.Delete: return VersionStatus.Versioned | VersionStatus.ScheduledDelete;
+ case SvnSchedule.Replace: return VersionStatus.Versioned | VersionStatus.ScheduledReplace;
+ }
+
+ switch (status) {
+ case SvnStatus.None: return VersionStatus.Versioned;
+ case SvnStatus.Normal: return VersionStatus.Versioned;
+ case SvnStatus.NotVersioned: return VersionStatus.Unversioned;
+ case SvnStatus.Modified: return VersionStatus.Versioned | VersionStatus.Modified;
+ case SvnStatus.Merged: return VersionStatus.Versioned | VersionStatus.Modified;
+ case SvnStatus.Conflicted: return VersionStatus.Versioned | VersionStatus.Conflicted;
+ case SvnStatus.Ignored: return VersionStatus.Unversioned | VersionStatus.Ignored;
+ case SvnStatus.Obstructed: return VersionStatus.Versioned;
+ case SvnStatus.Added: return VersionStatus.Versioned | VersionStatus.ScheduledAdd;
+ case SvnStatus.Deleted: return VersionStatus.Versioned | VersionStatus.ScheduledDelete;
+ case SvnStatus.Replaced: return VersionStatus.Versioned | VersionStatus.ScheduledReplace;
+ }
+
+ return VersionStatus.Unversioned;
+ }
+
+ public override void Lock (IProgressMonitor monitor, string comment, bool stealLock, params FilePath[] paths)
+ {
+ SvnLockArgs args = new SvnLockArgs ();
+ BindMonitor (args, 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)
+ {
+ SvnUnlockArgs args = new SvnUnlockArgs ();
+ BindMonitor (args, monitor);
+ args.BreakLock = breakLock;
+ lock (client)
+ client.Unlock (paths.ToStringArray (), args);
+ }
+
+ public override void Update (FilePath path, bool recurse, IProgressMonitor monitor)
+ {
+ SvnUpdateArgs args = new SvnUpdateArgs ();
+ BindMonitor (args, monitor);
+ args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
+ client.Update (path, args);
+ }
+
+ public override void Ignore (FilePath[] paths)
+ {
+ string result;
+ lock (client) {
+ foreach (var path in paths) {
+ if (client.GetProperty (new SvnPathTarget (path.ParentDirectory), SvnPropertyNames.SvnIgnore, out result)) {
+ client.SetProperty (path.ParentDirectory, SvnPropertyNames.SvnIgnore, result + path.FileName);
+ }
+ }
+ }
+ }
+
+ public override void Unignore (FilePath[] paths)
+ {
+ string result;
+ lock (client) {
+ foreach (var path in paths) {
+ if (client.GetProperty (new SvnPathTarget (path.ParentDirectory), SvnPropertyNames.SvnIgnore, out result)) {
+ int index = result.IndexOf (path.FileName + Environment.NewLine);
+ result = (index < 0) ? result : result.Remove (index, path.FileName.Length+Environment.NewLine.Length);
+ client.SetProperty (path.ParentDirectory, SvnPropertyNames.SvnIgnore, result);
+ }
+ }
+ }
+ }
+
+ public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
+ {
+ if (file == FilePath.Null)
+ throw new ArgumentNullException ();
+
+ SvnPathTarget target = new SvnPathTarget (file, SharpSvn.SvnRevision.Base);
+ MemoryStream data = new MemoryStream ();
+ int numAnnotations = 0;
+ client.Write (target, data);
+
+ using (StreamReader reader = new StreamReader (data)) {
+ reader.BaseStream.Seek (0, SeekOrigin.Begin);
+ while (reader.ReadLine () != null)
+ numAnnotations++;
+ }
+
+ System.Collections.ObjectModel.Collection<SvnBlameEventArgs> list;
+ SvnBlameArgs args = new SvnBlameArgs ();
+ args.Start = GetRevision (revStart);
+ args.End = GetRevision (revEnd);
+
+ if (client.GetBlame (target, args, out list)) {
+ Annotation[] annotations = new Annotation [numAnnotations];
+ foreach (var annotation in list) {
+ if (annotation.LineNumber < annotations.Length)
+ annotations [(int)annotation.LineNumber] = new Annotation (annotation.Revision.ToString (),
+ annotation.Author, annotation.Time);
+ }
+ return annotations;
+ }
+ return new Annotation[0];
+ }
+
+ SharpSvn.SvnRevision GetRevision (Revision rev)
+ {
+ if (rev == null)
+ return null;
+ SvnRevision srev = (SvnRevision) rev;
+ if (srev == SvnRevision.Base)
+ return new SharpSvn.SvnRevision (SvnRevisionType.Base);
+ if (srev == SvnRevision.Committed)
+ return new SharpSvn.SvnRevision (SvnRevisionType.Committed);
+ if (srev == SvnRevision.Head)
+ return new SharpSvn.SvnRevision (SvnRevisionType.Head);
+ if (srev == SvnRevision.Previous)
+ return new SharpSvn.SvnRevision (SvnRevisionType.Previous);
+ if (srev == SvnRevision.Working)
+ return new SharpSvn.SvnRevision (SvnRevisionType.Working);
+ return new SharpSvn.SvnRevision (srev.Rev);
+ }
+
+ SvnRevision ToBaseRevision (SharpSvn.SvnRevision rev)
+ {
+ if (rev.RevisionType == SvnRevisionType.Base)
+ return SvnRevision.Base;
+ if (rev.RevisionType == SvnRevisionType.Committed)
+ return SvnRevision.Committed;
+ if (rev.RevisionType == SvnRevisionType.Head)
+ return SvnRevision.Head;
+ if (rev.RevisionType == SvnRevisionType.Previous)
+ return SvnRevision.Previous;
+ if (rev.RevisionType == SvnRevisionType.Working)
+ return SvnRevision.Working;
+ if (rev.RevisionType == SvnRevisionType.Number)
+ return new SvnRevision (null, (int) rev.Revision);
+ throw new SubversionException ("Unknown revision type: " + rev.RevisionType);
+ }
+
+ class NotifData
+ {
+ public bool SendingData;
+ }
+
+ void BindMonitor (SvnClientArgs args, IProgressMonitor monitor)
+ {
+ NotifData data = new NotifData ();
+
+ args.Notify += delegate (object o, SvnNotifyEventArgs e) {
+ Notify (e, data, monitor);
+ };
+ args.Cancel += delegate (object o, SvnCancelEventArgs a) {
+ a.Cancel = monitor.IsCancelRequested;
+ };
+ args.SvnError += delegate (object o, SvnErrorEventArgs a) {
+ monitor.ReportError (a.Exception.Message, a.Exception.RootCause);
+ };
+ }
+
+ void Notify (SvnNotifyEventArgs e, NotifData notifData, IProgressMonitor monitor)
+ {
+ string actiondesc;
+ string file = e.Path;
+ bool skipEol = false;
+ bool notifyChange = false;
+
+ switch (e.Action) {
+ case SvnNotifyAction.Skip:
+ if (e.ContentState == SvnNotifyState.Missing) {
+ actiondesc = string.Format (GettextCatalog.GetString ("Skipped missing target: '{0}'"), file);
+ }
+ else {
+ actiondesc = string.Format (GettextCatalog.GetString ("Skipped '{0}'"), file);
+ }
+ break;
+ case SvnNotifyAction.UpdateDelete:
+ actiondesc = string.Format (GettextCatalog.GetString ("Deleted '{0}'"), file);
+ break;
+
+ case SvnNotifyAction.UpdateAdd:
+ if (e.ContentState == SvnNotifyState.Conflicted) {
+ actiondesc = string.Format (GettextCatalog.GetString ("Conflict {0}"), file);
+ }
+ else {
+ actiondesc = string.Format (GettextCatalog.GetString ("Added {0}"), file);
+ }
+ break;
+ case SvnNotifyAction.Restore:
+ actiondesc = string.Format (GettextCatalog.GetString ("Restored '{0}'"), file);
+ break;
+ case SvnNotifyAction.Revert:
+ actiondesc = string.Format (GettextCatalog.GetString ("Reverted '{0}'"), file);
+ break;
+ case SvnNotifyAction.RevertFailed:
+ actiondesc = string.Format (GettextCatalog.GetString ("Failed to revert '{0}' -- try updating instead."), file);
+ break;
+ case SvnNotifyAction.Resolved:
+ actiondesc = string.Format (GettextCatalog.GetString ("Resolved conflict state of '{0}'"), file);
+ break;
+ case SvnNotifyAction.Add:
+ if (e.MimeTypeIsBinary) {
+ actiondesc = string.Format (GettextCatalog.GetString ("Add (bin) '{0}'"), file);
+ }
+ else {
+ actiondesc = string.Format (GettextCatalog.GetString ("Add '{0}'"), file);
+ }
+ break;
+ case SvnNotifyAction.Delete:
+ actiondesc = string.Format (GettextCatalog.GetString ("Delete '{0}'"), file);
+ break;
+
+ case SvnNotifyAction.UpdateUpdate:
+ actiondesc = string.Format (GettextCatalog.GetString ("Update '{0}'"), file);
+ notifyChange = true;
+ break;
+ case SvnNotifyAction.UpdateExternal:
+ actiondesc = string.Format (GettextCatalog.GetString ("Fetching external item into '{0}'"), file);
+ break;
+ case SvnNotifyAction.UpdateCompleted: // TODO
+ actiondesc = GettextCatalog.GetString ("Finished");
+ break;
+ case SvnNotifyAction.StatusExternal:
+ actiondesc = string.Format (GettextCatalog.GetString ("Performing status on external item at '{0}'"), file);
+ break;
+ case SvnNotifyAction.StatusCompleted:
+ actiondesc = string.Format (GettextCatalog.GetString ("Status against revision: '{0}'"), e.Revision);
+ break;
+
+ case SvnNotifyAction.CommitDeleted:
+ actiondesc = string.Format (GettextCatalog.GetString ("Deleting {0}"), file);
+ break;
+ case SvnNotifyAction.CommitModified:
+ actiondesc = string.Format (GettextCatalog.GetString ("Sending {0}"), file);
+ notifyChange = true;
+ break;
+ case SvnNotifyAction.CommitAdded:
+ if (e.MimeTypeIsBinary) {
+ actiondesc = string.Format (GettextCatalog.GetString ("Adding (bin) '{0}'"), file);
+ }
+ else {
+ actiondesc = string.Format (GettextCatalog.GetString ("Adding '{0}'"), file);
+ }
+ break;
+ case SvnNotifyAction.CommitReplaced:
+ actiondesc = string.Format (GettextCatalog.GetString ("Replacing {0}"), file);
+ notifyChange = true;
+ break;
+ case SvnNotifyAction.CommitSendData:
+ if (!notifData.SendingData) {
+ notifData.SendingData = true;
+ actiondesc = GettextCatalog.GetString ("Transmitting file data");
+ }
+ else {
+ actiondesc = ".";
+ skipEol = true;
+ }
+ break;
+
+ case SvnNotifyAction.LockLocked:
+ actiondesc = string.Format (GettextCatalog.GetString ("'{0}' locked by user '{1}'."), file, e.Lock.Owner);
+ break;
+ case SvnNotifyAction.LockUnlocked:
+ actiondesc = string.Format (GettextCatalog.GetString ("'{0}' unlocked."), file);
+ break;
+ default:
+ actiondesc = e.Action.ToString () + " " + file;
+ break;
+ }
+
+ if (monitor != null) {
+ if (skipEol)
+ monitor.Log.Write (actiondesc);
+ else
+ monitor.Log.WriteLine (actiondesc);
+ }
+
+ if (notifyChange && File.Exists (file))
+ FileService.NotifyFileChanged (file, true);
+ }
+ }
+}
diff --git a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
new file mode 100644
index 0000000000..6c96bdd559
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
@@ -0,0 +1,137 @@
+<?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>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1038FBD8-750E-4081-BC65-D89FFED3C881}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SubversionAddinWindows</RootNamespace>
+ <AssemblyName>SubversionAddinWindows</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\VersionControl</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <GenerateDocumentation>true</GenerateDocumentation>
+ <NoWarn>1591;1573</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\VersionControl</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <DebugSymbols>true</DebugSymbols>
+ <GenerateDocumentation>true</GenerateDocumentation>
+ <NoWarn>1591;1573</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="SharpSvn, Version=1.7002.1998.12257, Culture=neutral, PublicKeyToken=d729672594885a28">
+ <HintPath>..\SharpSvn\SharpSvn.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SvnSharpClient.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Manifest.addin.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\SharpSvn\SharpPlink-Win32.svnExe">
+ <Link>SharpPlink-Win32.svnExe</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <Content Include="subversion-logo.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\SharpSvn\SharpSvn-DB44-20-win32.dll">
+ <Link>SharpSvn-DB44-20-win32.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\SharpSvn\SharpSvn-Sasl21-23-win32.dll">
+ <Link>SharpSvn-Sasl21-23-win32.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </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">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
+ <Name>MonoDevelop.Core</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\MonoDevelop.VersionControl\MonoDevelop.VersionControl.csproj">
+ <Project>{19DE0F35-D204-4FD8-A553-A19ECE05E24D}</Project>
+ <Name>MonoDevelop.VersionControl</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\MonoDevelop.VersionControl.Subversion\MonoDevelop.VersionControl.Subversion.csproj">
+ <Project>{183E084F-2C3B-4A6D-A8CE-6CDF3DC499AC}</Project>
+ <Name>MonoDevelop.VersionControl.Subversion</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/VersionControl/Subversion.Win32/subversion-logo.png b/main/src/addins/VersionControl/Subversion.Win32/subversion-logo.png
new file mode 100644
index 0000000000..08a7764249
--- /dev/null
+++ b/main/src/addins/VersionControl/Subversion.Win32/subversion-logo.png
Binary files differ