How To Merge Updates From Core
NB! Do NOT update the infrastructure without checking with the core
Initial work - the actual changes
The initial work to develop a new feature or fix a bug is done using your
- copy the changes to the corresponding files in
- make sure you do NOT bring any language-specific things over to the template
- make sure you do NOT bring any language-specific things over to the template
- edit the und.timestamp file (see next)
Now you are ready for the merge.
How to edit the und.timestamp file
You should edit the top of the file only.
Before you touch it the 2-3 first lines of
$Rev: 97047 $ Added WANT_OAHPA option for analysers for all languages (until now only generator)
You edit the file by writing the new message under the first line, and by
After you have edited it (but before checkin) it should look like this:
$Rev: 97047 $ And this is the new svn login message you write for your checkin. r97047: Added WANT_OAHPA option for analysers for all languages (until now only generator)
Then you check in the edited und.timestamp and the files that were changed in
Preferred: Merge all languages using make
In each of the langs directories, do as follows:
./autogen.sh ./configure make templatemerge
That's it! After the merge:
- check and resolve conflicts, if any
- check all modifications made
- commit (see details below)
Please review your changes, so that you won't commit changes that
Tips for verifying that the merge went well:
- count the number of modified files in the und/ template - check that
- check for conflicts
- compare the diff for the modified files in the und/ template and the same
Commit details
When committing a merge, try to commit all languages at once as long as the
Add a line of the following format on top of the commit message of the langs/
[Template merge - und/langs] Your commit message here.
The idea is that we can easily identify these commits later on.
Merge options
There are a couple of variables you can set for make when doing a merge:
USERNAME=abc # needed if you get errors about url mismatch between repo and working copy UNSAFE=yes # needed if you want to merge changes to modifiable files, like lexc files etc REVISION=123 # explicitly specify the revision to merge from
Option USERNAME
Use the USERNAME option if you get error messages like the following when
Copyfrom-url 'https://gtsvn.uit.no/langtech/trunk/giella-templates/langs-templates/und/am-shared/tools-spellcheckers-listbased-hunspell-dir-include.am' \ has different repository root than 'https://USERNAME@gtsvn.uit.no/langtech'
(replace USERNAME with your own username in subversion)
This message is caused by subversion trying to merge without a username, whereas
make templatemerge USERNAME=abc # replace 'abc' with your actual user name
Option UNSAFE
Give the UNSAFE variable a value yes to force merging of source files
make templatemerge UNSAFE=yes
Option REVISION
Specify the revision number in the variable REVISION to force the merge to
make templatemerge REVISION=12345
Renaming or moving files
The one thing that the merge scrimpt can't do well is to move files after a move
The merge process when moving or renaming files involves one additional step for
- change files in the template as needed, including moves and renames
- commit changes in the template
-
for each language in each language dir, move or rename the corresponding file(s)
- when all files are moved, merge as usual (see above). Ignore errors about files not found
A simple shell script for automating svn moves of files can look like this:
#!/bin/bash # This is a maintenance script to help propagate file moves or renames in the # core template to all languages. It loops over all language dirs as defined in # the *.am file and svn mv the files specified. # Extract the list of all languages from the *.am file: ALL_LANGS=$(egrep '^ALL_LANGS=' < Makefile.am | sed -e 's/ALL_LANGS=//') oldfile=$1 newfile=$2 for ll in $ALL_LANGS ; do if test -d $ll ; then svn mv $ll/$oldfile $ll/$newfile fi done echo echo "*** Done: all languages updated. ***" echo
Store this script in a file, place it in the top lang/ dir, and use it as
./move-in-svn.sh src/old-file src/new-file
Do NOT specify the language dir (in front of src/ in the example above).
Updating one language at a time
Steps to take for language $GTLANG:
-
cd $GTHOME/langs/$GTLANG/
-
$GTCORE/scripts/merge-templates.sh
- one can try to add the option --unsafe to get the script to try to merge
- one can try to add the option --unsafe to get the script to try to merge
- check and resolve conflicts, if any
- check all modifications made by the merge
- commit (see details above)
Updating languages outside $GTHOME/langs/
The process is the same for all language directories, ie directories whose name
What if your language is not automatically updated?
Make sure that the language code is listed in:
-
$GTHOME/langs/configure.ac
- $GTHOME/langs/Makefile.am
If not, add it to the list of language codes in those files. The same holds for
Conflicts after the merge
The basis for the scalability of the infrastructure is to avoid svn conflicts,
Systematic conflicts
These can be because there has been some change to the use of the language code
__UND__
In this case, merge as usual, and then do the following:
svn resolve --accept theirs-full */path/to/conflict/file time make replace_langcodes FILE=path/to/conflict/file
Now everything should be ok again, BUT:
There can also be other causes of systematic conflicts, review in each case, and
Random conflicts
If there are just random conflicts because you needed to update one of the