Vizzuality / LMIPy

Layer manager interface for Python
MIT License
2 stars 2 forks source link

Add merge method to Layers #83

Open 01painadam opened 4 years ago

01painadam commented 4 years ago

When creating new layers its often useful to employ the git paradigm of forking (in LMIPy this would be cloning) and existing layer and update it, as opposed creating a new one from scratch. This reduces mistakes as its often the case that the original layer works before cloning.

Right now, once a new version of a layer is created from a clone we often delete the old version and replace it. This is problematic as it causes slug and id changes which may need to be updating in the applications using the layer.

I propose that we improve this workflow by introducing a merge method into LMI, which would act as the inverse operation to .clone().

e.g.

                       --- layerB ---> layerB.update() --- layerB'.merge(layerA)
                     /                                                 |
layerA --->   layerA.clone() ---------- layerA -------------------- layerA' --------->

The method Layer.merge() should have the following behaviour: