Set Up Merge and Diff Tool¶
Before configuring DKCloudCommand, set up a local tool to visualize merge conflicts and differences between recipe files.
Tip
Version control terms: File Diff operations compare recipes local versus remote file copies within the same kitchen. File Merge operations compare remote recipe files across kitchens being merged.
Install and configure PyCharm¶
While DKCloudCommand will work with any tool that supports merging and viewing files in the command line, the following shows how to use PyCharm Community Edition.
- Download the free Community Edition of PyCharm for Windows, macOS, or Linux.
-
Set up your local device for the PyCharm path.
-
On Mac or Linux:
- Create your first project, saving the Location path provided. See PyCharm's Create a Python project for complete details.
-
In the new project, open the Tools menu and select Create Command-line Launcher. When prompted, save the Launcher Script.
Tip
Launcher script path: You can call the full path of PyCharm's launcher script using the
which charmshell command.
-
On Windows:
- Verify that PyCharm is included in your path environment variable.
PyCharm's typical installation path is
c:\Program Files\JetBrains\PyCharm Community Edition. - Restart your machine after editing your path environment variable for changes to take effect.
- Verify that PyCharm is included in your path environment variable.
PyCharm's typical installation path is
- Run commands to configure and test the local file diff and merge tool.
- On Mac or Linux:
- Run the
charm merge --helpcommand for quick reference to the syntax required for PyCharm file diff operations and merge operations. See PyCharm's CLI documentation for more context. - Use the syntax
/usr/local/bin/charm merge {{left}} {{right}} {{base}}for PyCharm to produce a three-pane merge window showing file versions:Source Kitchen File Version ||| Base File Version ||| Target Kitchen File Version - Use the syntax
/usr/local/bin/charm diff {{local}} {{remote}}for PyCharm to produce a two-pane diff window showing file versions:Local File Version ||| Remote File Version
- Run the
-
On Windows:
-
Run a file diff call for PyCharm.
[files_location]>pycharm diff file1.txt file2.txt -
Run a file merge call for PyCharm.
[files_location]>pycharm merge file1.txt file2.txt file3.txt -
Use the following example to complete the configuration for your PC:
-
-
Tip
PyCharm updates on Mac or Linux: After updating to a new version of PyCharm it may be necessary to recreate the Command Line Launcher.
Install and configure Meld¶
For a lightweight merge and diff alternative to PyCharm, you can also use DKCloudCommand with Meld.
- Download the open-source tool Meld for your operating system. Meld is supported on Linux and Windows, but the following walks through the PC setup.
- Verify that the installed location for Meld is included as a PATH environment variable.
- Run file diff and file merge calls. See meld.app/help/ for more information.
-
Use the following example to complete the configuration for DKCloudCommand: