configurationengine/doc/cli/merge.rst
author terytkon
Thu, 11 Mar 2010 17:04:37 +0200
changeset 0 2e8eeb919028
permissions -rw-r--r--
Adding EPL version of configurationengine.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     1
ConE merge action
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     2
=================
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     3
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     4
The merge functionality is meant to merge configurations/layers from a
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     5
remote project (defined with -r) to the current project (defined with
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     6
-p). Default value for the current project is the current working
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     7
directory. A project can be either a folder or a CPF/ZIP file.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     8
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     9
There are two ways to use merge:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    10
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    11
    #. Merge a configuration root into another
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    12
    #. Merge a specific source layer into a specific target layer
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    13
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    14
These translate to two use cases:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    15
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    16
    #. Merging an asset into an existing configuration project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    17
    #. Merging a variant data layer from an exported CPF back into the
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    18
       configuration project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    19
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    20
Examples for these two use cases are given below.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    21
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    22
Examples
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    23
--------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    24
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    25
Files containing the used example data:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    26
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    27
    - :download:`config_project.zip <merge/config_project.zip>`
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    28
    - :download:`myasset2.zip <merge/myasset2.zip>`
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    29
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    30
Merging an asset into configuration project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    31
'''''''''''''''''''''''''''''''''''''''''''
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    32
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    33
Say that we have a small configuration project that contains the configuration
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    34
interface and implementation of some component, and we want to merge this asset
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    35
as part of a configuration project, specifically into the ``assets/myassets/``
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    36
layer in the project. This can be done by using the layer -> layer merging
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    37
functionality.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    38
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    39
The image below shows what we want to accomplish. You can see that the 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    40
``assets/myassets/`` layer already contains asset1, and we want to merge asset2
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    41
there too.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    42
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    43
    .. image:: merge/asset_merge.png
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    44
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    45
We need to give ConE the layer root .confml files of the layers we want to
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    46
merge. To do this, run the following command:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    47
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
::
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
    > cone merge -p config_project --targetlayer assets/myassets/root.confml -r myasset2 --sourcelayer asset2/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
    Running action merge
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
    Target project: config_project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
    Source project: myasset2
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
    Target layer:   assets/myassets/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
    Source layer:   asset2/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
    Merging layers...
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
    Copying asset2/confml/asset2.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
    Copying asset2/content/asset2_data/dummy.txt
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
    Copying asset2/implml/asset2.templateml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
    Including confml/asset2.confml in layer root assets/myassets/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
Now the ``assets/myassets`` layer in the configuration project contains also
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
the contents of asset2.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
Merging a variant configuration into configuration project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
Another use case is merging the variant data layer of an exported CPF back
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
into the configuration project. This is where the configuration root merge
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
comes in.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
First, using the same example project as in the previous example, export a CPF
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
containing a variant data layer:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
::
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    76
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
    > cd config_project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
    config_project> cone export -c product_x_root.confml -r test.cpf --add variants/variant/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    79
    Running action export
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    80
    Export product_x_root.confml to test.cpf done!
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    81
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    82
Now the CPF can be modified somehow, here we'll add the content files ``foo.txt``
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    83
and ``bar.txt``. After this we can merge it back into the project as a new
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    84
configuration root that contains also the variant data layer:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    85
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    86
::
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    87
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    88
    config_project> cone merge -c foobar.confml -r test.cpf --rename
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    89
    Running action merge
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    90
    Target project: .
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    91
    Source project: test.cpf
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    92
    Target config:  foobar.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    93
    Source config:  product_x_root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    94
    Merging 1 layer(s)...
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    95
    Merging variants/variant/root.confml -> variants/variant_foobar/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    96
    Copying variants/variant/confml/data.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    97
    Copying variants/variant/content/bar.txt
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    98
    Copying variants/variant/content/foo.txt
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    99
    Including confml/data.confml in layer root variants/variant_foobar/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   100
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   101
The rename option tells ConE to rename the variant layer based on the given
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   102
configuration root name, so that the variant data layer becomes ``variants/variant_foobar/``.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   103
So, now the project looks like this:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   104
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   105
    .. image:: merge/project_after_variant_layer_merge.png
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   106
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   107
Note that the default merge doesn't overwrite the layers, it only adds/replaces
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   108
files from the source layers. If the entire layer should be overwritten, the
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   109
option --merge-policy can be used to specify that layers should be entirely
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   110
overwritten. For example, if we remove ``foo.txt`` from the variant content
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   111
in the CPF and re-merge like this:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   112
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   113
::
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   114
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   115
    config_project> cone merge -c foobar.confml -r test.cpf --rename --merge-policy overwrite-layer
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   116
    Running action merge
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   117
    Target project: .
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   118
    Source project: test.cpf
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   119
    Target config:  foobar.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   120
    Source config:  product_x_root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   121
    Merging 1 layer(s)...
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   122
    Merging variants/variant/root.confml -> variants/variant_foobar/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   123
    Copying variants/variant/confml/data.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   124
    Copying variants/variant/content/bar.txt
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   125
    Including confml/data.confml in layer root variants/variant_foobar/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   126
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   127
Now ``variants/variant_foobar/content/`` contains only ``bar.txt``.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   128
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   129
Options list
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   130
------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   131
    -c CONFIG, --configuration=CONFIG
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   132
                        defines the name of the target configuration for the
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   133
                        action
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   134
    -p STORAGE, --project=STORAGE
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   135
                        defines the location of current project. Default is
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   136
                        the current working directory.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   137
    -r STORAGE, --remote=STORAGE
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   138
                        defines the location of remote storage
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   139
    -s CONFIG, --sourceconfiguration=CONFIG
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   140
                        defines the name of the remote configuration inside
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   141
                        the remote storage for the merge action. Default is
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   142
                        the active root of the remote project.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   143
    --sourcelayer=LAYER_ROOT
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   144
                        Defines a specific layer to use as the layer to merge
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   145
                        from the remote project. Must be the layer root
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   146
                        (ConfML file).For example: --sourcelayer
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   147
                        assets/somelayer/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   148
    --targetlayer=LAYER_ROOT
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   149
                        Defines a specific layer (root) to use as the layer to
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   150
                        merge into the target project. Must be the layer root
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   151
                        (ConfML file).For example: --targetlayer
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   152
                        assets/somelayer/root.confml
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   153
    --rename            defines that the merged layers need to be renamed
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   154
    --all               Defines that the entire configuration (all layers)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   155
                        needs to be merged. This has no effect when merging
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   156
                        layers directly using --sourcelayer and --targetlayer.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   157
    -l LAYERS, --layer=LAYERS
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   158
                        Define the layers of the source configuration that are
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   159
                        included to merge action. The layer operation can be
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   160
                        used several times in a single command. Note that this
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   161
                        can only be used when merging configuration roots, not
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   162
                        specific layers using --sourcelayer and --targetlayer.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   163
                        Example -l -1 --layer=-2, which would append a layers
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   164
                        -1 and -2 to the layers => layers = -1,-2
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   165
    --merge-policy=MERGE_POLICY
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   166
                        Specifies the merge policy to use when merging layers.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   167
                        Possible values:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   168
                        replace-add - Add/replace files from source layer, but
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   169
                        leave other files in the target as they are.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   170
                        overwrite-layer - Overwrite the entire layer (remove
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   171
                        all previous content).