Bug 332672 - Provide API to query the differences between branches
Summary: Provide API to query the differences between branches
Status: REOPENED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2010-12-15 14:04 EST by Lothar Werzinger CLA
Modified: 2020-12-11 10:40 EST (History)
2 users (show)

See Also:


Attachments
Patch v1 (28.86 KB, patch)
2010-12-19 06:14 EST, Eike Stepper CLA
no flags Details | Diff
Patch v2 (28.86 KB, patch)
2010-12-19 06:28 EST, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lothar Werzinger CLA 2010-12-15 14:04:31 EST
Build Identifier: 

Currently there is no API to get the differences between two branches.
Please provide an API to get the differences between two branches.

As a workaround one can today create a fake merger that does not merge and access the differences from there:

class FakeMerger
  implements
    CDOMerger
{
  public CDOChangeSet target;
  public CDOChangeSet source;

  @Override
  public CDOChangeSetData merge(CDOChangeSet target, CDOChangeSet source)
  {
    this.target = target;
    this.source = source;
    
    // return null, and therefore do NOT do an actual merge
    return null;
  }
};
FakeMerger fakemerger = new FakeMerger();

CDOTransaction mergetransaction =
  transaction.getSession().openTransaction(testbranch);
mergetransaction.merge(mainbranch.getHead(), fakemerger);
mergetransaction.rollback();


Reproducible: Always
Comment 1 Jon Sorensen CLA 2010-12-16 19:51:00 EST
I would also be great if the API supported a diff between a historic model state and a branch. For example, what changed since 3/1/2010 for branch foo. Another example, what's the diff between branch foo at 3/1/2010 and MAIN today.
Comment 2 Eike Stepper CLA 2010-12-19 06:14:44 EST
Created attachment 185493 [details]
Patch v1
Comment 3 Eike Stepper CLA 2010-12-19 06:28:18 EST
Created attachment 185494 [details]
Patch v2
Comment 4 Eike Stepper CLA 2010-12-19 07:13:14 EST
Committed to HEAD
Comment 5 Eike Stepper CLA 2010-12-19 11:55:14 EST
Does not work correctly, yet...
Comment 6 Lothar Werzinger CLA 2010-12-19 13:03:12 EST
As collecting the diff is most likely a long running operation, would it make sense to pass in an optional IProgressMonitor?
Comment 7 Eike Stepper CLA 2010-12-19 13:07:49 EST
New API:

CDOChangeSetData CDOSession::compareRevisions(CDOBranchPoint source, CDOBranchPoint target);
CDOChangeSetData CDOView::compareRevisions(CDOBranchPoint source);

CDOTransaction CDOSession::openTransaction(CDOBranchPoint target, ResourceSet resourceSet);
CDOTransaction CDOSession::openTransaction(CDOBranchPoint target);

CDOView CDOSession::openView(CDOBranchPoint target, ResourceSet resourceSet);
CDOView CDOSession::openView(CDOBranchPoint target);
Comment 8 Eike Stepper CLA 2010-12-19 13:08:42 EST
(In reply to comment #1)
> I would also be great if the API supported a diff between a historic model state
> and a branch. For example, what changed since 3/1/2010 for branch foo. Another
> example, what's the diff between branch foo at 3/1/2010 and MAIN today.

All of these should work. Tests in org.eclipse.emf.cdo.tests.CompareTest.
Comment 9 Eike Stepper CLA 2010-12-19 13:11:28 EST
(In reply to comment #6)
> As collecting the diff is most likely a long running operation, would it make
> sense to pass in an optional IProgressMonitor?

I hesitate to add IProgressMonitor to our API a second time.
Comment 10 Eike Stepper CLA 2010-12-19 13:12:10 EST
Usually you'd schedule the compareRevisions() call to a background thread anyway.
Comment 11 Lothar Werzinger CLA 2010-12-19 13:19:35 EST
(In reply to comment #10)
> Usually you'd schedule the compareRevisions() call to a background thread
> anyway.

That's true, but it might still be nice to know how far along it is (if that information is available).

Oh, and I did not quite understand the comment #5 (what second time?)
Comment 12 Eike Stepper CLA 2010-12-19 13:21:42 EST
I was referring to CDOTransaction.commit(IProgressMonitor). Since CDO is supposed to run outside of Eclipse that turned out as a poor choice.
Comment 13 Lothar Werzinger CLA 2010-12-19 13:38:46 EST
I se(In reply to comment #12)
> I was referring to CDOTransaction.commit(IProgressMonitor). Since CDO is
> supposed to run outside of Eclipse that turned out as a poor choice.

I see. Well you could create your own version of a ICDOProgressMonitor that allows an easy adaption for eclipse users like

IProgressMonitor monitor = //get the Eclipse monitor
transaction.commit(new CDOProgressMonitor(monitor));

that way you can support progress monitors that are eclipse independent.
Comment 14 Eike Stepper CLA 2010-12-19 14:19:38 EST
We have that in Net4j: OMMonitor / EclipseMonitor ;-)
Comment 15 Eike Stepper CLA 2011-06-23 03:58:11 EDT
Moving all open enhancement requests to 4.1
Comment 16 Eike Stepper CLA 2012-08-14 22:56:43 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 17 Eike Stepper CLA 2013-06-27 04:07:20 EDT
Moving all outstanding enhancements to 4.3
Comment 18 Eike Stepper CLA 2014-08-19 09:25:41 EDT
Moving all open enhancement requests to 4.4
Comment 19 Eike Stepper CLA 2014-08-19 09:36:14 EDT
Moving all open enhancement requests to 4.4
Comment 20 Eike Stepper CLA 2015-07-14 02:19:54 EDT
Moving all open bugzillas to 4.5.
Comment 21 Eike Stepper CLA 2016-07-31 01:02:39 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 22 Eike Stepper CLA 2017-12-28 01:20:13 EST
Moving all open bugs to 4.7
Comment 23 Eike Stepper CLA 2019-11-08 02:12:26 EST
Moving all unresolved issues to version 4.8-
Comment 24 Eike Stepper CLA 2019-12-13 12:45:44 EST
Moving all unresolved issues to version 4.9
Comment 25 Eike Stepper CLA 2020-12-11 10:40:16 EST
Moving to 4.13.