Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9ab97e319bc00e6a522d5a0c18c76654684b5967 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ccvs.core;

import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

/**
 * Specialized revision comparison that only fails the comparison when the remote revision is a later
 * revision on the same branch as the local resource.
 */
public class CVSRevisionOnBranchCompareCriteria extends CVSRevisionNumberCompareCriteria {

	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ccvs.core.CVSRevisionNumberCompareCriteria#compare(byte[], byte[])
	 */
	protected boolean compare(byte[] localBytes, byte[] remoteBytes) throws CVSException {
		// First, check if the revisions are the same
		if (super.compare(localBytes, remoteBytes)) return true;
		// Only fail the compare if the remote bytes are on the same branch but a later revision.
		// This is done to ignore stale sync bytes in the cache
		return !ResourceSyncInfo.isLaterRevisionOnSameBranch(remoteBytes, localBytes);
	}

}

Back to the top