예제 #1
0
		public override void Ignore (FilePath[] paths)
		{
			IntPtr result;
			IntPtr props_ptr;
			var props = new StringBuilder ();
			string new_path;
			LibSvnClient.svn_string_t new_props;
			LibSvnClient.Rev rev = LibSvnClient.Rev.Working;

			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (null);
				foreach (var path in paths) {
					new_path = NormalizePath (path, localpool);
					CheckError (svn.client_propget (out result, "svn:ignore", Path.GetDirectoryName (new_path),
					                                ref rev, false, ctx, localpool));
					GetProps (props, localpool, result);

					props.AppendLine (Path.GetFileName (new_path));
					new_props = new LibSvnClient.svn_string_t {
						data = Marshal.StringToHGlobalAnsi (props.ToString ()),
						len = props.Length,
					};
					props_ptr = apr.pcalloc (localpool, new_props);
					CheckError (svn.client_propset ("svn:ignore", props_ptr, Path.GetDirectoryName (new_path), false, localpool));
				}
			} finally {
				TryEndOperation (localpool);
			}
		}
예제 #2
0
		public override void Unignore (FilePath[] paths)
		{
			IntPtr result;
			IntPtr props_ptr;
			var props = new StringBuilder ();
			string new_path;
			LibSvnClient.svn_string_t new_props;
			LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
			int index;
			string props_str;

			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (null);
				foreach (var path in paths) {
					new_path = NormalizePath (path, localpool);
					CheckError (svn.client_propget (out result, "svn:ignore", Path.GetDirectoryName (new_path),
					                                ref rev, false, ctx, localpool));
					GetProps (props, localpool, result);

					props_str = props.ToString ();
					index = props_str.IndexOf (Path.GetFileName (new_path) + Environment.NewLine, StringComparison.Ordinal);
					props_str = (index < 0) ? props_str : props_str.Remove (index, Path.GetFileName(new_path).Length+1);

					new_props = new LibSvnClient.svn_string_t {
						data = Marshal.StringToHGlobalAnsi (props_str),
						len = props_str.Length,
					};
					props_ptr = apr.pcalloc (localpool, new_props);
					CheckError (svn.client_propset ("svn:ignore", props_ptr, Path.GetDirectoryName (new_path), false, localpool));
				}
			} finally {
				TryEndOperation (localpool);
			}
		}
예제 #3
0
		public override void Unignore (FilePath[] paths)
		{
			IntPtr hash_item, hash_name, hash_val;
			int length;
			IntPtr result;
			IntPtr props_ptr = IntPtr.Zero;
			StringBuilder props = new StringBuilder ();
			string new_path;
			LibSvnClient.svn_string_t new_props;
			LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
			int index;
			string props_str;

			var localpool = TryStartOperation (null);
			try {
				foreach (var path in paths) {
					new_path = NormalizePath (path, localpool);
					CheckError (svn.client_propget (out result, "svn:ignore", Path.GetDirectoryName (new_path),
					                                ref rev, false, ctx, localpool));
					hash_item = apr.hash_first (localpool, result);
					while (hash_item != IntPtr.Zero) {
						apr.hash_this (hash_item, out hash_name, out length, out hash_val);
						new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
						props.Append (Marshal.PtrToStringAnsi (new_props.data));
						hash_item = apr.hash_next (hash_item);
					}
					props_str = props.ToString ();
					index = props_str.IndexOf (Path.GetFileName (new_path) + Environment.NewLine, StringComparison.Ordinal);
					props_str = (index < 0) ? props_str : props_str.Remove (index, Path.GetFileName(new_path).Length+1);

					new_props = new LibSvnClient.svn_string_t ();
					new_props.data = Marshal.StringToHGlobalAnsi (props_str);
					new_props.len = props_str.Length;
					props_ptr = apr.pcalloc (localpool, new_props);
					CheckError (svn.client_propset ("svn:ignore", props_ptr, Path.GetDirectoryName (new_path), false, localpool));
				}
			} finally {
				apr.pool_destroy (localpool);
				TryEndOperation ();
			}
		}