#!/bin/sh # -*- coding: utf-8 -*- # # Copyright 2013 Stephan Hennig # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # if test $# -eq 0 then echo "usage: po-diff.sh []" echo "This script is an attempt to support tracing changes in the patgen run between different commits. Arguments are two directories containing working copies corresponding to different commits. By default, second argument is the current directory. For every spelling, this script applies the following procedure: 1) In both working copies: a) Run patgen. b) Create diffs of temporary patgen output files pattmp., where is a number between 1 and 8 and corresponds to a patgen stage. Result is stored in files .diff. These files contain lots of words whose hyphenation changed within a patgen stage. 2) Create second order diff of two files .diff corresponding to different working copies (commits), but the same patgen stage. Result is stored in files ..diff in the new working copy. Resulting files, again, contain words whose hyphenation changed within a patgen stage, but with all words removed whose hyphenation changed in the same way in both working copies (commits). That is, second order diff files contain only words whose patgen handling changed between both commits." | fold -s -w 79 exit 1 fi # Strip trailing slashes from directory name. FROMPATH=${1%%/} # Default TO path is current directory. TOPATH=${2-.} TOPATH=${TOPATH%%/} # Function definition. diff_patgen_pattmp_one_path() { typeset path=$1 diff $path/pattmp.1 $path/pattmp.2 | grep "^[><-]" > $path/12.diff diff $path/pattmp.2 $path/pattmp.3 | grep "^[><-]" > $path/23.diff diff $path/pattmp.3 $path/pattmp.4 | grep "^[><-]" > $path/34.diff diff $path/pattmp.4 $path/pattmp.5 | grep "^[><-]" > $path/45.diff diff $path/pattmp.5 $path/pattmp.6 | grep "^[><-]" > $path/56.diff diff $path/pattmp.6 $path/pattmp.7 | grep "^[><-]" > $path/67.diff diff $path/pattmp.7 $path/pattmp.8 | grep "^[><-]" > $path/78.diff } # Function definition. diff_patgen_pattmp() { typeset frompath=$1 topath=$2 spell=$3 diff_patgen_pattmp_one_path $frompath/$spell diff_patgen_pattmp_one_path $topath/$spell diff $frompath/$spell/12.diff $topath/$spell/12.diff > $topath/$spell.12.diff diff $frompath/$spell/23.diff $topath/$spell/23.diff > $topath/$spell.23.diff diff $frompath/$spell/34.diff $topath/$spell/34.diff > $topath/$spell.34.diff diff $frompath/$spell/45.diff $topath/$spell/45.diff > $topath/$spell.45.diff diff $frompath/$spell/56.diff $topath/$spell/56.diff > $topath/$spell.56.diff diff $frompath/$spell/67.diff $topath/$spell/67.diff > $topath/$spell.67.diff diff $frompath/$spell/78.diff $topath/$spell/78.diff > $topath/$spell.78.diff } echo "Diff'ing temporary patgen input files." diff_patgen_pattmp $FROMPATH $TOPATH dehypht-x diff_patgen_pattmp $FROMPATH $TOPATH dehyphn-x diff_patgen_pattmp $FROMPATH $TOPATH dehyphts-x