Ejemplo n.º 1
0
		public Status SingleStatus(string filename)
		{
			Debug("SVN: SingleStatus(" + filename + ")");
			BeforeOperation("stat");
			try {
				filename = FileUtility.NormalizePath(filename);
				SvnStatusArgs args = new SvnStatusArgs {
					Revision = SvnRevision.Working,
					RetrieveAllEntries = true,
					RetrieveIgnoredEntries = true,
					Depth = SvnDepth.Empty
				};
				Status result = null;
				client.Status(
					filename, args,
					delegate (object sender, SvnStatusEventArgs e) {
						Debug("SVN: SingleStatus.callback(" + e.FullPath + "," + e.LocalContentStatus + ")");
						System.Diagnostics.Debug.Assert(filename.Equals(e.FullPath, StringComparison.OrdinalIgnoreCase));
						result = new Status {
							Copied = e.LocalCopied,
							TextStatus = ToStatusKind(e.LocalContentStatus)
						};
					}
				);
				if (result != null) {
					return result;
				} else {
					return new Status {
						TextStatus = StatusKind.None
					};
				}
			} catch (SvnException ex) {
				throw new SvnClientException(ex);
			} finally {
				AfterOperation();
			}
		}
Ejemplo n.º 2
0
		public Status SingleStatus(string filename)
		{
			filename = FileUtility.NormalizePath(filename);
			Status result = null;
			if (statusCache.TryGetValue(filename, out result)) {
				Debug("SVN: SingleStatus(" + filename + ") = cached " + result.TextStatus);
				return result;
			}
			Debug("SVN: SingleStatus(" + filename + ")");
			BeforeReadOperation("stat");
			try {
				SvnStatusArgs args = new SvnStatusArgs {
					Revision = SvnRevision.Working,
					RetrieveAllEntries = true,
					RetrieveIgnoredEntries = true,
					Depth = SvnDepth.Empty
				};
				client.Status(
					filename, args,
					delegate (object sender, SvnStatusEventArgs e) {
						Debug("SVN: SingleStatus.callback(" + e.FullPath + "," + e.LocalContentStatus + ")");
						System.Diagnostics.Debug.Assert(filename.ToString().Equals(e.FullPath, StringComparison.OrdinalIgnoreCase));
						result = new Status {
							Copied = e.LocalCopied,
							TextStatus = ToStatusKind(e.LocalContentStatus)
						};
					}
				);
				if (result == null) {
					result = new Status {
						TextStatus = StatusKind.None
					};
				}
				statusCache.Add(filename, result);
				return result;
			} catch (SvnException ex) {
				switch (ex.SvnErrorCode) {
					case SvnErrorCode.SVN_ERR_WC_UPGRADE_REQUIRED:
						result = new Status { TextStatus = StatusKind.None };
						break;
					case SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY:
						result = new Status { TextStatus = StatusKind.Unversioned };
						break;
					default:
						throw new SvnClientException(ex);
				}
				statusCache.Add(filename, result);
				return result;
			} finally {
				AfterOperation();
			}
		}