Controlled Package reassignment on Pull (potentially a lot of refactoring) #6130
Labels
refactoring
Change code without altering functionality
repo
Related to repository class
serialization
Translate between object types and files
Let's start from far. It would be nice if AG did fully automated and one-click code deployment. Unfortunately for large products it is not so. Usually a relatively large change (including DDIC changes, code changes, package reassignments, adding/deletion of classes) supposes clicking Pull multiple times (I remember like 6-7 times ...), suppressing activation errors and etc. I think that fully automated deployment is kind of a dream right now or at least not achievable in one step for sure. So I'd focus on a closer aim - make the deployment more controllable to be able to do portions of it in stages.
The #6090 was a good step in that direction. Another step that would be nice is separate package reassignments. Upon a complex update import different local/remote packages makes a huge mess as there are no proper diffs. I'd like to have a button (in a Pull dialog) to apply this change only and then to be able to observe the changes in aligned way. Now this is not possible. It seemed like an easy task but appeared very far from that. The responsible code is very intertwined, structures are indirect, some names are very generic to understand what was intended. I can probably try to go forward but I'm tentative to start it, because it will probably involve a lot of changes, probably structure changes, maybe class changes ... so a lot of refactoring in several iterations, and if I start it I'd like to have support: openness for such changes, some advises (as I don't know this part of the code well) and some testing and of course constructive reviews on the way :)
A bit more on code.
Playground structure.
The case: ZDESERTEST1 prog is changed and reassigned to TEST2 package.
Now what happens now if I pull this. AG shows 2 dialogs, which is already confusing!
But although somewhat clunky, intuitively I expect this work from the box. Just select "Change assignment" in the first dialog and skip the second ! Bingo ! But no ... it just does nothing ...
... and by the way the deserialization list comes empty to
ZCL_ABAPGIT_OBJECTS=>DESERIALIZE
Let's debug
The file status returns more or less understandable results:
Though it is confusing why abap files do not have PACKMOVE flag. Though nothing critical at this stage
Then we come to
object_checks->DESERIALIZE_CHECKS
and this start to be very confusing. First there iswarning_overwrite_find
which first produces almost logical data set (let alone the "delete and recreate" + "Add local" in one place as well as no mention of TEST2 package)But the last statements
delete comparing OBJ_TYPE/NAME
reduces it one lineWhich is even OK for my goal :) If it worked. But certainly confusing from the code logic perspective.
then another call named
warning_package_find
produces thisAnd as I mentioned if I select just the "Change assignment" option it does nothing. But what happen if I choose both ? Well, it works :) Good for the user ... in this simple case. But how it looks from the code perspective ?
The
ZCL_ABAPGIT_OBJECTS=>DESERIALIZE
receives one line (just one, not 2 as I could expect from the dialogs)The line has local-delete status, and no packmove. Sadly, because a very promising
change_package_assignments
call a bit later is just skipped. And the program is updated and reassigned by the dedicated object class. Which, I confess, the expected end result ... but with not control and with some dark magic in between. :))So far this was y journey I this subject.
Where I would probably start. probably I'd reconsider how those pieces of code exchange the information. E.g. most of the code above uses
zif_abapgit_definitions=>ty_results_tt
type, which (let alone a very unclear name) is very generic, so the code parts in between must do a lot of work to infere all kinds of things. I'd try to make it more readable and direct. Also probably I'd look into how classes call each other, they are very coupled now, I'd probably think how to transfer data with params instead of objects. But just thoughts. No clear plan. Just directions. The problem appeared a lot more complex than I originally expected.What do you think ?
The text was updated successfully, but these errors were encountered: