= Updating QWG Repository Trunk = [[TracNav]] [[TOC(inline)]] Normal development process for templates is to develop templates in a Quattor configuration database, where you can deploy the new templates in a real (test or production) environment. Only after, you have validated the modification in your environment, you should update the QWG repository. New or modified templates '''should always''' be committed to the QWG [source:templates/trunk repository trunk] first, never directly in a [source:templates/branches branch] or [source:templates/tags tag]. As much as possible, there should be one commit by elementary change. Avoid huge commit implementing many unrelated changes are they are more difficult to track and to revert. Also take care of putting useful commit message for each commit. == Merging change from a production SCDB == It is quite important not to break the history when a template is moved from one location to another or removed. And the trunk is not a direct copy of a real repository. To help updating the trunk from a real Quattor configuration database, you should use [source:templates/trunk/tools/directory-sync directory-sync] tool. '''This tool must be run from a local workspace of QWG [source:templates/trunk repository trunk]'''. This tool updates a trunk directory with the contents of a specified source, doing the following : * For each directory existing both in QWG repository and in source tree : * Removes all `.tpl` files from the destination directory (the directory to update). * Copy all .tpl files from the source directory (built by appending destination directory name to source directory root) * For each directory in the source tree and not in the repository, copy the tree from the source tree and add files to SVN QWG repository. * For each directory in the repository but no longer in the source tree, do a `svn rm` of the directory. * Show the differences with `svn status` As you run this tool from a SVN workspace, you always have the opportunity to do a `svn revert` in case things went wrong... You need to fix manually the unexpected differences. Unexpected differences are all the templates that existed in the repository but no longer exist in the local workspace or all the templates copied from the source but not registered in the repository. There are 3 situations : * A template has been renamed or moved. In this case, you should revert the change for this template, do the relevant `svn mv` and rerun [source:templates/trunk/tools/directory-sync directory-sync] to avoid breaking the template modification history. * Else, if the template existed in the repository but is no longer present in the workspace (flagged `!` by `svn status`), it can be safely removed from the repository with command : {{{ svn rm --force template_name.tpl }}} * Else, if the template is present in the workspace but not registered into the repository ((flagged `?` by `svn status`) and this is a new template, it should be added to the repository with one of theses commands : {{{ # Add one specific template template_name.tpl svn add template_name.tpl # Add all the files not yet registered in the repository svn add `svn status | grep '^\?' | awk '{print $2}'` }}} When you have cleaned up the situation for all the templates, except those that are present in the workspace (because they are used in your local Quattor configuration) but don't need to be in the repository, you can do the final cleanup with : {{{ rm `svn status | grep '^\?' | awk '{print $2}'` }}} When there is no more templates flagged as `!` (missing) or `?` (unknown), you can commit your changes to the repository. Please, take care of setting up a useful message for the commit as this is the only source for a ChangeLog... == Tagging a new release == After committing your changes, if you think they are worth a new 'release' or are ready for insertion into a specific branch, refer to the documentation about [wiki:Development/RelTagging] tagging] a new release.