[EGIT PATCH 15/20] Refactor getRevSort() calls to hasRevSort()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is not signifficant performance improvement, just avoids creation of
few unnecessary objects.
However, it improves encapsulation and keeps existing RevSort checking
code consistent with further use of hasRevSort().

Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx>
---
 .../src/org/spearce/jgit/revwalk/ObjectWalk.java   |    2 +-
 .../org/spearce/jgit/revwalk/StartGenerator.java   |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java
index a36c1cc..68ed861 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java
@@ -198,7 +198,7 @@ public class ObjectWalk extends RevWalk {
 				return null;
 			if ((r.flags & UNINTERESTING) != 0) {
 				markTreeUninteresting(r.getTree());
-				if (getRevSort().contains(RevSort.BOUNDARY))
+				if (hasRevSort(RevSort.BOUNDARY))
 					return r;
 				continue;
 			}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/StartGenerator.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/StartGenerator.java
index debd168..7ddcd3c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/StartGenerator.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/StartGenerator.java
@@ -38,7 +38,6 @@
 package org.spearce.jgit.revwalk;
 
 import java.io.IOException;
-import java.util.EnumSet;
 
 import org.spearce.jgit.errors.IncorrectObjectTypeException;
 import org.spearce.jgit.errors.MissingObjectException;
@@ -91,8 +90,7 @@ class StartGenerator extends Generator {
 			return mbg.next();
 		}
 
-		final EnumSet<RevSort> sort = w.getRevSort();
-		boolean boundary = sort.contains(RevSort.BOUNDARY);
+		boolean boundary = walker.hasRevSort(RevSort.BOUNDARY);
 
 		if (!boundary && walker instanceof ObjectWalk) {
 			// The object walker requires boundary support to color
@@ -110,9 +108,10 @@ class StartGenerator extends Generator {
 		}
 
 		int pendingOutputType = 0;
-		if (sort.contains(RevSort.START_ORDER) && !(q instanceof FIFORevQueue))
+		if (walker.hasRevSort(RevSort.START_ORDER)
+				&& !(q instanceof FIFORevQueue))
 			q = new FIFORevQueue(q);
-		if (sort.contains(RevSort.COMMIT_TIME_DESC)
+		if (walker.hasRevSort(RevSort.COMMIT_TIME_DESC)
 				&& !(q instanceof DateRevQueue))
 			q = new DateRevQueue(q);
 		if (tf != TreeFilter.ALL) {
@@ -141,9 +140,10 @@ class StartGenerator extends Generator {
 			g = new RewriteGenerator(g);
 		}
 
-		if (sort.contains(RevSort.TOPO) && (g.outputType() & SORT_TOPO) == 0)
+		if (walker.hasRevSort(RevSort.TOPO)
+				&& (g.outputType() & SORT_TOPO) == 0)
 			g = new TopoSortGenerator(g);
-		if (sort.contains(RevSort.REVERSE))
+		if (walker.hasRevSort(RevSort.REVERSE))
 			g = new LIFORevQueue(q);
 		if (boundary)
 			g = new BoundaryGenerator(w, g);
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux