/*******************************************************************************
 * Copyright (c) 2007-2008 VecTrace (Zingo Andersen) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     VecTrace (Zingo Andersen) - implementation
 *     Stefan Groschupf          - logError
 *     Stefan C                  - Code cleanup
 *******************************************************************************/
package com.vectrace.MercurialEclipse.history;

import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.history.IFileHistory;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.history.provider.FileHistoryProvider;

import com.vectrace.MercurialEclipse.team.MercurialTeamProvider;

/**
 * @author zingo
 *
 */
public class MercurialHistoryProvider extends FileHistoryProvider {

	public MercurialHistoryProvider() {
		super();
	}

	public IFileHistory getFileHistoryFor(IResource resource, int flags, IProgressMonitor monitor) {
		RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) resource)
				.getProject());
		if (provider instanceof MercurialTeamProvider) {
			return new MercurialHistory(resource);
		}
		return null;
	}

	public IFileHistory getFileHistoryFor(IFileStore store, int flags, IProgressMonitor monitor) {
		return null;
	}

	public IFileRevision getWorkspaceFileRevision(IResource resource) {
		return null;
	}
}

@@ -810,16 +810,63 @@
 source;%0A
+import org.eclipse.core.runtime.CoreException;%0A
 import o
@@ -907,16 +907,16 @@
 onitor;%0A
-
 import o
@@ -1127,16 +1127,77 @@
 vider;%0A%0A
+import com.vectrace.MercurialEclipse.MercurialEclipsePlugin;%0A
 import c
@@ -1657,22 +1657,42 @@
 r) %7B%0A%09%09%09
-return
+MercurialHistory history =
  new Mer
@@ -1716,16 +1716,169 @@
 ource);%0A
+%09%09%09try %7B%0A%09%09%09%09history.refresh(monitor, Integer.MAX_VALUE);%0A%09%09%09%7D catch (CoreException e) %7B%0A%09%09%09%09MercurialEclipsePlugin.logError(e);%0A%09%09%09%7D%0A%09%09%09return history;%0A
 %09%09%7D%0A%09%09re

Fix MercurialHistoryProvider