New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing rewrite on classes using traits then commiting remove class side traits #5988
Comments
AFAICT this has nothing to do with rewriting. It's just that |
Oh, I see that we integrated already in Moose some PRs that remove some class side definition... This is really bad since it is happening in the stable release. |
|
Looks like @tesonep recently wrote a fix for this: pharo-vcs/tonel@7df3b4e |
Nope, that commit does not fix our issue. |
There appear to be two unrelated problems:
|
Here's a very ugly hack for fixing the IceGitWorkingCopyUpdateVisitor>>visitPackage: anIcePackageDefinition
"I am a package, I have to export my changes using the repository format.
Thus, I cut here the recursion on my children, I have to do the recursion myself"
| mcPackage snapshot patcher version patcherDefinitions |
mcPackage := MCPackage named: anIcePackageDefinition name.
"Take a snapshot of the package from the version we want to apply our changes on (usually the commit in disk) and apply them to it.
This will create a snapshot with only the selected changes"
snapshot := [diff targetVersion snapshotFor: anIcePackageDefinition]
on: NotFound do: [ MCSnapshot empty ].
patcher := MCPatcher snapshot: snapshot.
currentNode accept: (IceMCSnapshotPatchVisitor new
patcher: patcher;
yourself).
"<----- HACK"
patcherDefinitions := (patcher instVarNamed: 'definitions') definitions.
patcherDefinitions
select: [ :e | e class = MCClassTraitDefinition ]
thenDo: [ :e |
patcherDefinitions
detect: [ :def |
def class = MCTraitDefinition and: [
def className = e className ] ]
ifFound: [ :def |
def
instVarNamed: 'classTraitComposition'
put: e classTraitComposition ]
ifNone: [ ] ].
"----->"
version := MCVersion new
setPackage: mcPackage
info: (IceMCVersionInfo package: mcPackage message: 'Internal...')
snapshot: patcher patchedSnapshot
dependencies: #().
"Save version to disk.
The repository will take care of the correct output format.
Note: this step does not perform a commit, it just exports changes so the repository can then perform a commit"
index storeVersion: version |
Awesome! Thanks! |
Hi guys, will this also be released in Pharo 8? Currently working with traits in Pharo 8 is a bit challenging without this fix :) |
Yes, I have it in my TODO list to make a back port
…On Wed, Apr 1, 2020 at 4:35 PM George Ganea ***@***.***> wrote:
Hi guys, will this also be released in Pharo 8? Currently working with
traits in Pharo 8 is a bit challenging without this fix :)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#5988 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACWY75ZIQVCKJ2PCICVPXLRKNGLPANCNFSM4LSV56TQ>
.
--
Pablo Tesone.
tesonep@gmail.com
|
Describe the bug
In the current Moose image (5a091ef9709b216816b51941ef104695758864f1) I executed this script:
The I commited. When I commited, I only saw my changes. But in the files, multiple classes lost their class side trait usages.
For example, this line vanished from a lot of files:
But the trait usage is still here.
The text was updated successfully, but these errors were encountered: