Example #1
0
		public override void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths)
		{
			nb = new notify_baton ();
			var localpool = TryStartOperation (monitor);
			try {
				IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
				foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				}
				lockFileList = new ArrayList ();
				requiredLockState = LibSvnClient.NotifyLockState.Unlocked;
			
				CheckError (svn.client_unlock (array, breakLock, ctx, localpool));
				if (paths.Length != lockFileList.Count)
					throw new SubversionException ("Lock operation failed.");
			} finally {
				apr.pool_destroy (localpool);
				lockFileList = null;
				TryEndOperation ();
			}
		}
Example #2
0
		public override void Add (FilePath path, bool recurse, ProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();

			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				string pathorurl = NormalizePath (path, localpool);
				CheckError (svn.client_add3 (pathorurl, recurse, true, false, ctx, localpool));
			} finally {
				TryEndOperation (localpool);
			}
		}
Example #3
0
		public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
		{
			if (paths == null || message == null || monitor == null)
				throw new ArgumentNullException();

			nb = new notify_baton ();
			var localpool = TryStartOperation (monitor);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
				foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				}

				IntPtr commit_info = IntPtr.Zero;
				commitmessage = message;
				
				CheckError (svn.client_commit (ref commit_info, array, false, ctx, localpool));
				unsafe {
					if (commit_info != IntPtr.Zero) {
						monitor.Log.WriteLine ();
						monitor.Log.WriteLine (GettextCatalog.GetString ("Revision: {0}", ((LibSvnClient.svn_client_commit_info_t *) commit_info.ToPointer())->revision));
					}
				}
			} finally {
				commitmessage = null;
				apr.pool_destroy (localpool);
				TryEndOperation ();
			}
		}
Example #4
0
		public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();

			nb = new notify_baton ();
			var localpool = TryStartOperation (monitor);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
				//foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				//}
				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_delete (ref commit_info, array, force, ctx, localpool));
			} finally {
				commitmessage = null;
				apr.pool_destroy (localpool);
				TryEndOperation ();
			}
		}
Example #5
0
		public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor)
		{
			if (srcPath == FilePath.Null || destPath == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();
			
			LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;

			nb = new notify_baton ();
			IntPtr commit_info = IntPtr.Zero;
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				string nsrcPath = NormalizePath (srcPath, localpool);
				string ndestPath = NormalizePath (destPath, localpool);
				CheckError (svn.client_move (ref commit_info, nsrcPath, ref revision,
				                             ndestPath, force, ctx, localpool));
			} finally {
				TryEndOperation (localpool);
			}
		}
		public override void Commit (FilePath[] paths, string message, IProgressMonitor monitor)
		{
			if (paths == null || message == null || monitor == null)
				throw new ArgumentNullException();
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			
			nb = new notify_baton ();
			updatemonitor = monitor;
			
			IntPtr localpool = newpool (pool);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
				foreach (string path in paths) {
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, path));
				}
				
				IntPtr commit_info = IntPtr.Zero;
				
				commitmessage = message;
				
				CheckError (svn.client_commit (ref commit_info, array, 0, ctx, localpool));
				unsafe {
					if (commit_info != IntPtr.Zero) {
						monitor.Log.WriteLine ();
						monitor.Log.WriteLine (GettextCatalog.GetString ("Revision: {0}", ((LibSvnClient.svn_client_commit_info_t *) commit_info.ToPointer())->revision));
					}
				}
			} finally {
				commitmessage = null;
				updatemonitor = null;
				apr.pool_destroy (localpool);
				inProgress = false;
			}
		}
Example #7
0
		public override void Delete (FilePath path, bool force, IProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			
			nb = new notify_baton ();
			updatemonitor = monitor;
			
			IntPtr localpool = newpool (pool);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
				//foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				//}
				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_delete (ref commit_info, array, (force ? 1 : 0), ctx, localpool));
			} finally {
				commitmessage = null;
				updatemonitor = null;
				apr.pool_destroy (localpool);
				inProgress = false;
			}
		}
Example #8
0
		public override void Mkdir (string[] paths, string message, ProgressMonitor monitor) 
		{
			if (paths == null || monitor == null)
				throw new ArgumentNullException ();

			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				IntPtr array = NormalizePaths (localpool, paths.Select (p => (FilePath)p).ToArray ());
				
				commitmessage = message;

				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_mkdir2 (ref commit_info, array, ctx, localpool));
			} finally {	
				commitmessage = null;
				TryEndOperation (localpool);
			}
		}
Example #9
0
		public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			nb = new notify_baton ();
			updatemonitor = monitor;
			IntPtr localpool = newpool (pool);
			try {
				string pathorurl = NormalizePath (path, localpool);
				CheckError (svn.client_add3 (pathorurl, (recurse ? 1 : 0), 1, 0, ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				updatemonitor = null;
				inProgress = false;
			}
		}
Example #10
0
		public override void Checkout (string url, FilePath path, Revision revision, bool recurse, IProgressMonitor monitor)
		{
			if (url == null || monitor == null)
				throw new ArgumentNullException ();
			
			if (revision == null)
				revision = SvnRevision.Head;
			LibSvnClient.Rev rev = (LibSvnClient.Rev) revision;
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			nb = new notify_baton ();
			updatemonitor = monitor;
			IntPtr result_rev = IntPtr.Zero;
			IntPtr localpool = newpool (pool);
			try {
				// Using Uri here because the normalization method doesn't remove the redundant port number when using https
				url = NormalizePath (new Uri(url).ToString(), localpool);
				string npath = NormalizePath (path, localpool);
				CheckError (svn.client_checkout (result_rev, url, npath, ref rev, (recurse ? 1 :0), ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				updatemonitor = null;
				inProgress = false;
			}
		}
Example #11
0
		public override void Mkdir (string[] paths, string message, IProgressMonitor monitor) 
		{
			if (paths == null || monitor == null)
				throw new ArgumentNullException ();
		
			TryStartOperation ();

			nb = new notify_baton ();
			updatemonitor = monitor;
			
			IntPtr localpool = newpool(pool);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, paths.Length, IntPtr.Size);
				foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				}
				
				commitmessage = message;

				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_mkdir2 (ref commit_info, array, ctx, localpool));
			} finally {	
				commitmessage = null;
				updatemonitor = null;
				apr.pool_destroy (localpool);
				TryEndOperation ();
			}
		}
Example #12
0
		public override void Add (FilePath path, bool recurse, IProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();

			TryStartOperation ();

			nb = new notify_baton ();
			updatemonitor = monitor;
			IntPtr localpool = newpool (pool);
			try {
				string pathorurl = NormalizePath (path, localpool);
				CheckError (svn.client_add3 (pathorurl, recurse, true, false, ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				updatemonitor = null;
				TryEndOperation ();
			}
		}
		public override void Mkdir (string[] paths, string message, IProgressMonitor monitor) 
		{
			if (paths == null || monitor == null)
				throw new ArgumentNullException ();
		
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}

			nb = new notify_baton ();
			updatemonitor = monitor;
			
			IntPtr localpool = newpool(pool);
			try {
				// Put each item into an APR array.
				IntPtr array = apr.array_make (localpool, paths.Length, IntPtr.Size);
				foreach (string path in paths) {
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, path));
				}
				
				commitmessage = message;

				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_mkdir2 (ref commit_info, array, ctx, localpool));
			} finally {	
				commitmessage = null;
				updatemonitor = null;
				apr.pool_destroy (localpool);
				inProgress = false;
			}
		}
Example #14
0
		public override void Checkout (string url, FilePath path, Revision revision, bool recurse, ProgressMonitor monitor)
		{
			if (url == null || monitor == null)
				throw new ArgumentNullException ();
			
			if (revision == null)
				revision = SvnRevision.Head;
			var rev = (LibSvnClient.Rev) revision;
			
			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				// Using Uri here because the normalization method doesn't remove the redundant port number when using https
				url = NormalizePath (new Uri(url).ToString(), localpool);
				string npath = NormalizePath (path, localpool);
				CheckError (svn.client_checkout (IntPtr.Zero, url, npath, ref rev, recurse, ctx, localpool));
			} catch (SubversionException e) {
				if (e.ErrorCode != 200015)
					throw;

				if (Directory.Exists (path.ParentDirectory))
					FileService.DeleteDirectory (path.ParentDirectory);
			} finally {
				TryEndOperation (localpool);
			}
		}
Example #15
0
		public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor)
		{
			if (srcPath == FilePath.Null || destPath == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();
			
			LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			
			nb = new notify_baton ();
			updatemonitor = monitor;
			IntPtr commit_info = IntPtr.Zero;
			IntPtr localpool = newpool (pool);
			try {
				string nsrcPath = NormalizePath (srcPath, localpool);
				string ndestPath = NormalizePath (destPath, localpool);
				CheckError (svn.client_move (ref commit_info, nsrcPath, ref revision,
				                             ndestPath, (force ? 1 : 0), ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				updatemonitor = null;
				inProgress = false;
			}
		}
Example #16
0
		public override void Commit (FilePath[] paths, string message, ProgressMonitor monitor)
		{
			if (paths == null || message == null || monitor == null)
				throw new ArgumentNullException();

			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				IntPtr array = NormalizePaths (localpool, paths);
				IntPtr commit_info = IntPtr.Zero;
				commitmessage = message;
				
				CheckError (svn.client_commit (ref commit_info, array, false, ctx, localpool));
				unsafe {
					if (commit_info != IntPtr.Zero) {
						monitor.Log.WriteLine ();
						monitor.Log.WriteLine (GettextCatalog.GetString ("Revision: {0}", ((LibSvnClient.svn_client_commit_info_t *) commit_info.ToPointer())->revision));
					}
				}
			} finally {
				commitmessage = null;
				TryEndOperation (localpool);
			}
		}
Example #17
0
		public override void Unlock (IProgressMonitor monitor, bool breakLock, params FilePath[] paths)
		{
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			
			IntPtr localpool = newpool (pool);
			IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
			updatemonitor = monitor;
			nb = new notify_baton ();
			
			try {
				foreach (string path in paths) {
					string npath = NormalizePath (path, localpool);
					IntPtr item = apr.array_push (array);
					Marshal.WriteIntPtr (item, apr.pstrdup (localpool, npath));
				}
				lockFileList = new ArrayList ();
				requiredLockState = LibSvnClient.NotifyLockState.Unlocked;
			
				CheckError (svn.client_unlock (array, breakLock ? 1 : 0, ctx, localpool));
				if (paths.Length != lockFileList.Count)
					throw new SubversionException ("Lock operation failed.");
			} finally {
				apr.pool_destroy (localpool);
				lockFileList = null;
				updatemonitor = null;
				inProgress = false;
			}
		}
Example #18
0
		public override void Delete (FilePath path, bool force, ProgressMonitor monitor)
		{
			if (path == FilePath.Null || monitor == null)
				throw new ArgumentNullException ();

			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				IntPtr array = NormalizePaths (localpool, path);
				IntPtr commit_info = IntPtr.Zero;
				CheckError (svn.client_delete (ref commit_info, array, force, ctx, localpool));
			} finally {
				commitmessage = null;
				TryEndOperation (localpool);
			}
		}
Example #19
0
		public override void Checkout (string url, FilePath path, Revision revision, bool recurse, IProgressMonitor monitor)
		{
			if (url == null || monitor == null)
				throw new ArgumentNullException ();
			
			if (revision == null)
				revision = SvnRevision.Head;
			LibSvnClient.Rev rev = (LibSvnClient.Rev) revision;
			
			nb = new notify_baton ();
			var localpool = TryStartOperation (monitor);
			try {
				// Using Uri here because the normalization method doesn't remove the redundant port number when using https
				url = NormalizePath (new Uri(url).ToString(), localpool);
				string npath = NormalizePath (path, localpool);
				CheckError (svn.client_checkout (IntPtr.Zero, url, npath, ref rev, recurse, ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				TryEndOperation ();
			}
		}
Example #20
0
		public override void Unlock (ProgressMonitor monitor, bool breakLock, params FilePath[] paths)
		{
			nb = new notify_baton ();
			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (monitor);
				IntPtr array = NormalizePaths (localpool, paths);
				lockFileList = new ArrayList ();
				requiredLockState = LibSvnClient.NotifyLockState.Unlocked;
			
				CheckError (svn.client_unlock (array, breakLock, ctx, localpool));
				if (paths.Length != lockFileList.Count)
					throw new SubversionException ("Unlock operation failed.");
			} finally {
				lockFileList = null;
				TryEndOperation (localpool);
			}
		}
		public override void Checkout (string url, FilePath path, Revision revision, bool recurse, IProgressMonitor monitor)
		{
			if (url == null || monitor == null)
				throw new ArgumentNullException ();
			
			if (revision == null)
				revision = SvnRevision.Head;
			LibSvnClient.Rev rev = (LibSvnClient.Rev) revision;
			
			lock (sync) {
				if (inProgress)
					throw new SubversionException ("Another Subversion operation is already in progress.");
				inProgress = true;
			}
			nb = new notify_baton ();
			updatemonitor = monitor;
			IntPtr result_rev = IntPtr.Zero;
			IntPtr localpool = newpool (pool);
			try {
				CheckError (svn.client_checkout (result_rev, url, path, ref rev, (recurse ? 1 :0), ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
				updatemonitor = null;
				inProgress = false;
			}
		}