[EGIT PATCH 3/9] Connect the history page to the refs update subscription mechanism

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

 



Now the history page can get updated automatically without polling.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---
 .../egit/ui/internal/history/GitHistoryPage.java   |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
index 7e2f726..418f3b6 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
@@ -168,6 +168,9 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener {
 	/** Last HEAD */
 	private AnyObjectId currentHeadId;
 
+	/** We need to remember the current repository */
+	private Repository db;
+
 	/**
 	 * Highlight flag that can be applied to commits to make them stand out.
 	 * <p>
@@ -536,6 +539,9 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener {
 			revObjectSelectionProvider.setActiveRepository(null);
 		cancelRefreshJob();
 
+		if (db != null)
+			db.removeRepositoryChangedListener(this);
+
 		if (graph == null)
 			return false;
 
@@ -543,7 +549,8 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener {
 		if (in == null || in.length == 0)
 			return false;
 
-		Repository db = null;
+		db = null;
+
 		final ArrayList<String> paths = new ArrayList<String>(in.length);
 		for (final IResource r : in) {
 			final RepositoryMapping map = RepositoryMapping.getMapping(r);
@@ -563,6 +570,8 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener {
 		if (db == null)
 			return false;
 
+		db.addRepositoryChangedListener(this);
+
 		final AnyObjectId headId;
 		try {
 			headId = db.resolve("HEAD");
-- 
1.5.6.2.220.g44701

--
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