[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Further reduction of l10n sync commits



After the discussion, I conducted a few tests and they actually made
me think more deeply about this part of the code.

So, I finally come up with the attached patch.

The philosophy is the following:

When a package PO file would be modified when merged with the master
file, then the file is *really* changed only when the changes are:

-one of the *non filtered* headers is changed. Namely "MIME-Version", 
 "Content-Type", "Content-Transfer-Encoding" or "Plural-Forms"

-a non comment line is changed (usually because a translation changed,
 of course)


This actually means that individual files will ONLY get their header
changed when there is a REAL change in the file, which affects the
content.

As I have tested, this should reduce the number of l10n commit
dramatically.

Please comment...



--- /home/bubulle/src/debian/debian-installer/scripts/l10n/l10n-sync	2006-03-07 19:56:46.822688204 +0100
+++ scripts/l10n/l10n-sync	2006-03-12 12:30:28.079420615 +0100
@@ -566,16 +566,16 @@
 	# EXCEPT the fuzzy markers (^\#,.*$)
         oldfiltered=`tempfile`
         newfiltered=`tempfile`
-        filter="((PO-Revision-Date|Project-Id-Version|Report-Msgid-Bugs-To|POT-Creation-Date|Last-Translator|Language-Team|MIME-Version|Content-Type|Content-Transfer-Encoding|X-Generator|Plural-Forms):)|^#[^,]|^\#$"
+	filter="^(\"(PO-Revision-Date|Project-Id-Version|Report-Msgid-Bugs-To|POT-Creation-Date|Last-Translator|Language-Team|X-):|#[^,]|#$)"
         egrep -v "$filter" $lang.po >$oldfiltered
         egrep -v "$filter" $lang.po.new >$newfiltered
-        if [ -z "$(diff --ignore-matching-lines="PO-Revision-Date:" $lang.po $lang.po.new)" ] ; then
-	  # We don't commit if only PO-Revision-Date changed
+        if [ -z "$(diff $oldfiltered $newfiltered)" ] ; then
+	  # We don't commit if a filtered line was the only change
 	  rm $lang.po.new
         else
+	  # At least one non filtered line changed
           # We put the old Revision-Date back if asked for
-	  # or if only a comment or header line changed
-	  if [ "$KEEP_REVISION" != "N" -a "$KEEP_REVISION" = "$lang" -o $(diff $oldfiltered $newfiltered | wc -l) = 0 ] ; then
+	  if [ "$KEEP_REVISION" != "N" -a "$KEEP_REVISION" = "$lang" ] ; then
 	    # We grab back the PO-Revision-Date from the old file
 	    old_revision=`cat $lang.po| grep -e "^\"PO-Revision-Date:" | sed 's/\\\\n\"//g'`
 	    # And we replace the one from the new file by it

Attachment: signature.asc
Description: Digital signature


Reply to: