[EGIT PATCH 14/20] Add hasRevSort() in RevWalk for faster sorting strategy checking

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

 



Direct calls to this method let us avoid unnecessary cloning of
getRevSort() output just for checking existance of some strategy.

Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx>
---
 .../src/org/spearce/jgit/revwalk/RevWalk.java      |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
index 4cb75ec..fc757a5 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
@@ -389,6 +389,17 @@ public class RevWalk implements Iterable<RevCommit> {
 	}
 
 	/**
+	 * Check whether the provided sorting strategy is enabled.
+	 * 
+	 * @param sort
+	 *            a sorting strategy to look for.
+	 * @return true if this strategy is enabled, false otherwise
+	 */
+	public boolean hasRevSort(RevSort sort) {
+		return sorting.contains(sort);
+	}
+
+	/**
 	 * Select a single sorting strategy for the returned commits.
 	 * <p>
 	 * Disables all sorting strategies, then enables only the single strategy
-- 
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