DESCRIPTION

Implement equals(Object) and hashCode() for CommitFileRevision
so editors can be reused

When editors are asked to be opened in the Eclipse workbench, the
default behaviour is to simply activate an existing editor if an
existing editor shares the input with the input that is to be
opened. The contract for comparing editor inputs is via the
equals(Object) method. For a FileRevisionEditorInput, this
is implemented by checking the equality between the two inputs'
underlying file revisions. As such, CommitFileRevision should 
implement equals(Object) (and hashCode() for consistency) so that
the same editor can be reused instead of having multiple editors
open on a given revision.

Change-Id: I2abeef934b21986979f84f9836e0bf2b44eff41f


COMMENTS

author: Jaylon Avila
date: 2010-04-23 00:51:31.000000000

Patch Set 1: No score

To see a bug that is caused by this problem, just show the history of a file that's under version control. Then right-click on a revision and select 'Open'. If you do it again, a second editor is opened even though it should've just reused the existing one.

As to the implementation of the two methods, I actually just asked JDT to generate them for me. The generated method fixes the problem but it seems to me that because RevCommit enforces an identity check in its equals(Object) implementation, perhaps we should be comparing the two values of commit.name()?

The ObjectId probably also needs to be considered. Having one null value and one non-null value does not necessarily indicate they are not equal as it may merely hint at the fact that the former hasn't had getStorage(IProgressMonitor) called on it yet.

-------------------------------------
author: Carlie Harper
date: 2010-06-01 15:36:42.000000000

Patch Set 1: No score; No score

I think that it should be sufficient to use commit.hashCode() and commit.equals(Object).

commit cannot be null and it is an instance of AnyObjectId which is supposed to be unique.

-------------------------------------
