iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Warning about newer version raised even when ignoreImage is used on Metacello instance

Open Bajger opened this issue 2 years ago • 1 comments

Describe the bug Warning about newer version of package is raised even if user specified the image state to be ignored.

To Reproduce Steps to reproduce the behavior:

  1. Download latest stable P10 Pharo and evaluate in playground:
Metacello new 
	baseline: 'Clap';
 	repository: 'github://demarey/clap-st:refactoring/src';
	ignoreImage;
   load.
  1. Warning dialog with Load/merge option is raised. image

Expected behavior Instead of raising: "MCMergeOrLoadWarning: You are about to load new versions of the following packages that have unsaved changes in the image", loading should continue without warning dialog opened and incoming packages should be used instead of packages from image.

This problem creates difficulty in non-interactive mode, when following is evaluated:

/pharo Pharo.image eval --save "Metacello new baseline: 'Clap'; repository: 'github://demarey/clap-st:refactoring/src'; ignoreImage; load"

since non-interactive UI policy merges the changes, instead of using incoming (see ConfigurationCommandLineHandler>>#handleMergeConflictDuring:). This results in fact that user defined project is not properly loaded and previous version packages are merged instead of incoming.

Version information:

  • OS: any
  • Version: P10, latest stable

Expected development cost Probably to add something to ignoreImage handler to use somerhing like: [loadBlock] on: MCMergeOrLoadWarning do: [ :warning | warning load ]]

Note: I'm not sure, if applied change will work for command-line handler, since on:do: block (in ConfigurationCommandLineHandler>>#handleMergeConflictDuring:) of command line handler might catch it first, instead of ignoreImage implementation.

Bajger avatar Jul 14 '22 10:07 Bajger

Some proposal:

  1. Change implementation of: MetacelloScriptEngine>>handleNotificationsForAction: actionBlock --> add there on: MCMergeOrLoadWarning do: [ex handleResolutionFor: self]
  2. add method on MCMergeOrLoadWarning>>handeResolutionFor: anEngine --> like aScriptEngine handleMergeOrLoad: self
  3. implement #handleMergeOrLoad: exception ^ (self options at: #'onMergeOrLoad' ifAbsent: [ ^ exception pass ]) cull: exception

Disadvantage: implementation of HandleResolutionFor: is out of hiearchy of MetacalloScriptNotification. So I don`t know if it might be a problem.

Bajger avatar Jul 14 '22 14:07 Bajger