Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Apply patch in Sync view

Revision as of 11:21, 10 December 2009 by Unnamed Poltroon (Talk) (Synchronize wizard)

Idea.png
This page is under construction: I haven't described the suggested solution in details neither I have listed up all the issues yet.


Problem

Provide an alternative way of applying patches. Desired behavior, which could in future replace the current one, is to use the Synchronize View to display content of a patch, resolve potential conflicts and apply the patch eventually. This way while the comparison is being done, other features of Eclipse are available to use, we are not bounded to the current Apply Patch wizard.

This is tracked by bug 236169.

Solution

The proposed solution consist of several parts:

  • Subscriber - a subscriber implementation that provides synchronization between local resources to be patched and their in-memory representation with changes from the patch applied. As the result of it's nature, the subscriber does not contact any remote server. It's a three-way comparison, all changes from the patch are treated as incoming.
  • SyncInfo - sync info node is returned to resources that would be affected by the patch. The direction of the sync info node can be either incoming or conflicting (for unmatched changes).
  • IResourceVariant - represents local resource with changes from the patch
  • ModelProvider -
    • model objects -
    • ResourceMappings -
  • org.eclipse.team.ui.synchronizeWizards extension point -
  • org.eclipse.team.ui.synchronizeParticipants extension point -
  • org.eclipse.ui.navigator.navigatorContent extension point -
    • content providers -
    • label providers -
  • org.eclipse.team.ui.teamContentProviders - associates the patch model provider with the patch content provider
  • org.eclipse.core.runtime.adapters -

Tasks

Note.png
Overall progress
21% (11/52)


Required changes are grouped in the following areas:

Synchronize participant, subscriber

  • Ok green.gif Add synchronize participant + subscriber
  • Ok green.gif IResourceVariant implementation should return patched files when asked for Storage
  • Persistable, intitialized on startup; remember which hunks have been applied; remember patch options set
  • Pinnable
  • Listen to workspace changes, reapply all hunks for a file when needed using the patch options already set
  • Progress.gif bug: Applying changes should remove it from the sync view - change state to 'in sync'
  • Make sure non-workspace patches can be applied via Sync view as well
  • Close (ask to close) participant when all hunks have been applied, so it won't bother about forthcoming resource changes (deltas)

Synchronize wizard

  • Ok green.gif Apply Patch sync participant/wizard should be available in the Synchronize wizard

Synchronize wizard - participant page (work in progress)

  • Ok green.gif Embed apply patch wizard into synchronize wizard so patch (input) can be selected
  • Progress.gif Setting bounds for a nested wizard is an issue, see bug 297470
  • Ok green.gif Add a page to the new wizard where user can select how the patch should be applied (traditionally, preview in the wizard or in Sync view)
  • Add more options to the new wizard page, see bug 198149 and bug 117298

New page in the apply patch wizard (mockup)

  • Provide a proper icon for the participant
  • Provide valid description for the participant

Model Provider

  • Ok green.gif Model objects for hunks
  • Ok green.gif Don't block other model providers to participate in synchronization (applying patch)
  • Ok green.gif Other model providers do not display hunks

Java model when applying patch (work in progress)

  • Use DiffProject, FilePatch2 and Hunk as model objects
  • Ok green.gif Use PatchDiffNodes as model objects, they represent the result of applying a patch (not the patch strucutre as types above) and they implement ICompareInput so are compare-ready
  • Missing objects representing folders, the result is something like flat presentation
  • Other models do not indicate any conflicts when applying a patch -> unmerged hunks should be treated as sync view conflicts, see also #Label provider

Sync view

  • Status line should display lines added/removed by the patch
  • NPE when trying to switch to a different synchronization when applying patch (see bug 256972)
  • 'Schedule' action in the view's drop down menu should be disabled (or removed)
  • Link with Editor

Content provider

Hunks (work in progress)

  • Ok green.gif Display hunks in Sync view
  • Hunks objects never have children, get rid of the [+] sign

Label provider

  • Display Patch options settings: fuzz factor, offset used (bug 205762), moved from(?). All per hunk.
  • Use conflict ('double-headed red arrow') icon instead of 'red X' icon for unmatched hunks
  • Indicate when a project from the patch doesn't exist in the workspace

Context menu

Current sync's view context menu when applying patch (work in progress)

  • Update means now 'Apply'
  • 'Apply' should work for projects, files and individual hunks
  • 'Apply' should be disabled for unmatched hunks
  • 'Apply' on file/project containing unmatched hunks should affect matched hunks only
  • Do we need two 'Apply' variants: merge and overwrite-and-update?
  • Add 'Open'/'Open With' actions
  • Ok green.gif Add 'Open in Compare' action
  • 'Remove from View' means now 'Exclude'
  • No 'Exclude' action available, replaced with 'Remove from the view'

View toolbar

  • 'Copy All Incoming Changes...' / 'Merge All Non-conflicting Changes' means 'Apply All'
  • Only 'Incoming' and 'Conflicts' mode should be available
  • 'Flat presentation' is meaningless for Patch Model (see also bug 277107)

Operations

Make all operations in the Apply Patch wizard be available in the Sync view (when applying a patch).

Patch options

Apply Patch wizard, Patch preview page

  • Re-applying patch -> synchronize again
  • Remember set options when re-applying: fuzz factor, ignored segments, moved hunks
  • Ignore segments setting applies to all files in the patch -> re-apply
  • Reverse patch on sync's view toolbar(?)
  • Ok green.gif Show matched Hunks: All hunks are shown
  • Show excluded Hunks -> Sync's view drop down > Restore Removed Items
  • Fuzz factor / Guess
  • Generate .rej files for unmerged hunks - applies to all changes from the patch
  • Move hunk

Compare Editor

  • Progress.gif 'Open In Compare Editor' for a file should display full file content with changes from all hunks
  • Progress.gif bug: Open in Compare editor for a file (in a patch) displays Hunks in the structure view. First hunk is select on start but nothing is displayed in the compare content area.

'Open in Compare Editor' for a file 1 (work in progress) 'Open in Compare Editor' for a file 2 (work in progress) 'Open in Compare Editor' for a file 3 (work in progress)

  • 'Open In Compare Editor' should be available for hunks
  • Progress.gif bug: No Java structure available for Java files; fine(?) for hunks

Java structure in Compare editor opened for a hunk (work in progress)

  • Progress.gif bug: ClassCastException when right-clicking in comparison for a file

Source code

No source code is available yet, the plan is to commit to a public branch soon. Or at least submit a dirty patch on the bug 236169.

Back to the top