changeset 127:2e395db595e2

Moved HgStatus to toplevel
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 16 Feb 2011 18:42:10 +0100
parents b92a638764be
children 44b97930570c
files src/org/tmatesoft/hg/core/HgStatus.java src/org/tmatesoft/hg/core/StatusCommand.java test/org/tmatesoft/hg/test/TestStatus.java
diffstat 3 files changed, 66 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/tmatesoft/hg/core/HgStatus.java	Wed Feb 16 18:42:10 2011 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011 TMate Software Ltd
+ *  
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * For information on how to redistribute this software under
+ * the terms of a license other than GNU General Public License
+ * contact TMate Software at support@svnkit.com
+ */
+package org.tmatesoft.hg.core;
+
+public class HgStatus {
+
+	public enum Kind {
+		Modified, Added, Removed, Unknown, Missing, Clean, Ignored
+	};
+
+	private final HgStatus.Kind kind;
+	private final Path path;
+	private final Path origin;
+		
+	HgStatus(HgStatus.Kind kind, Path path) {
+		this(kind, path, null);
+	}
+
+	HgStatus(HgStatus.Kind kind, Path path, Path copyOrigin) {
+		this.kind = kind;
+		this.path  = path;
+		origin = copyOrigin;
+	}
+
+	public HgStatus.Kind getKind() {
+		return kind;
+	}
+
+	public Path getPath() {
+		return path;
+	}
+
+	public Path getOriginalPath() {
+		return origin;
+	}
+
+	public boolean isCopy() {
+		return origin != null;
+	}
+		
+//	public String getModificationAuthor() {
+//	}
+//
+//	public Date getModificationDate() {
+//	}
+}
\ No newline at end of file
--- a/src/org/tmatesoft/hg/core/StatusCommand.java	Tue Feb 15 07:03:14 2011 +0100
+++ b/src/org/tmatesoft/hg/core/StatusCommand.java	Wed Feb 16 18:42:10 2011 +0100
@@ -16,13 +16,12 @@
  */
 package org.tmatesoft.hg.core;
 
-import static org.tmatesoft.hg.core.StatusCommand.HgStatus.Kind.*;
+import static org.tmatesoft.hg.core.HgStatus.Kind.*;
 import static org.tmatesoft.hg.repo.HgRepository.*;
 
 import java.util.ConcurrentModificationException;
 
 import org.tmatesoft.hg.core.Path.Matcher;
-import org.tmatesoft.hg.core.StatusCommand.HgStatus.Kind;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.repo.HgStatusCollector;
 import org.tmatesoft.hg.repo.HgStatusInspector;
@@ -177,42 +176,6 @@
 		void handleStatus(HgStatus s);
 	}
 
-	public static class HgStatus {
-		public enum Kind {
-			Modified, Added, Removed, Unknown, Missing, Clean, Ignored
-		};
-		private final Kind kind;
-		private final Path path;
-		private final Path origin;
-		
-		HgStatus(Kind kind, Path path) {
-			this(kind, path, null);
-		}
-
-		HgStatus(Kind kind, Path path, Path copyOrigin) {
-			this.kind = kind;
-			this.path  = path;
-			origin = copyOrigin;
-		}
-
-		public Kind getKind() {
-			return kind;
-		}
-
-		public Path getPath() {
-			return path;
-		}
-
-		public Path getOriginalPath() {
-			return origin;
-		}
-
-		public boolean isCopy() {
-			return origin != null;
-		}
-	}
-
-	
 	private class Mediator implements HgStatusInspector {
 		boolean needModified;
 		boolean needAdded;
@@ -257,7 +220,7 @@
 		public void copied(Path fnameOrigin, Path fnameAdded) {
 			if (needCopies) {
 				if (matcher == null || matcher.accept(fnameAdded)) {
-					handler.handleStatus(new HgStatus(Kind.Added, fnameAdded, fnameOrigin));
+					handler.handleStatus(new HgStatus(Added, fnameAdded, fnameOrigin));
 				}
 			}
 		}
--- a/test/org/tmatesoft/hg/test/TestStatus.java	Tue Feb 15 07:03:14 2011 +0100
+++ b/test/org/tmatesoft/hg/test/TestStatus.java	Wed Feb 16 18:42:10 2011 +0100
@@ -17,7 +17,8 @@
 package org.tmatesoft.hg.test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
-import static org.tmatesoft.hg.core.StatusCommand.HgStatus.Kind.*;
+import static org.tmatesoft.hg.core.HgStatus.*;
+import static org.tmatesoft.hg.core.HgStatus.Kind.*;
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
 import java.util.Collection;
@@ -31,10 +32,9 @@
 import org.junit.Assume;
 import org.junit.Rule;
 import org.junit.Test;
+import org.tmatesoft.hg.core.HgStatus;
 import org.tmatesoft.hg.core.Path;
 import org.tmatesoft.hg.core.StatusCommand;
-import org.tmatesoft.hg.core.StatusCommand.HgStatus;
-import org.tmatesoft.hg.core.StatusCommand.HgStatus.Kind;
 import org.tmatesoft.hg.repo.HgLookup;
 import org.tmatesoft.hg.repo.HgRepository;
 import org.tmatesoft.hg.repo.HgStatusCollector;
@@ -126,7 +126,7 @@
 	}
 	
 	private static class StatusCollector implements StatusCommand.Handler {
-		private final Map<StatusCommand.HgStatus.Kind, List<Path>> map = new TreeMap<StatusCommand.HgStatus.Kind, List<Path>>();
+		private final Map<HgStatus.Kind, List<Path>> map = new TreeMap<HgStatus.Kind, List<Path>>();
 
 		public void handleStatus(HgStatus s) {
 			List<Path> l = map.get(s.getKind());