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

Bug#901180: release notes fails to build in a clean checkout



Bonjour, 

Dixit Laura Arjona Reina, le 09/06/2018 :

>I guess the "transcount" script needs to be adapted to use git instead
>of subversion.

The attached patch works, but the statistics for ca & cs are wrong
because the svn revision tracked now don't match the actual git hash.
And ca & cs translators will need to find the git hash
corresponding to the old svn revision to know where to look back to
update the translation. This have to be done only once, but before to
keep correct stats.

Baptiste
diff --git a/transcount b/transcount
index 2d8c9be2..20c84dd7 100755
--- a/transcount
+++ b/transcount
@@ -21,10 +21,8 @@ if __name__ == "__main__":
     total = sum(sizes.values())
     revisions = {}
     for fn in filenames:
-        for attr in os.popen("svn info %s/%s" % (origlang, fn)).readlines():
-            if attr.startswith("Last Changed Rev:"):
-                _, revision = attr.split(":", 1)
-                revisions[fn] = int(revision)
+        for attr in os.popen("git log --format=%%H -n 1 %s/%s" % (origlang, fn)).readlines():
+            revisions[fn] = attr
     # looking for marker: "^<!-- English version: 1234 -->$"
     rev_re = re.compile("^\s*<!--\s+English version:\s+([0-9]+)\s+-->\s*$")
     for lng in targetlangs:
@@ -34,11 +32,11 @@ if __name__ == "__main__":
                 match = rev_re.match(line)
                 if match:
                     revision = int(rev_re.match(line).group(1))
-                    if revision >= revisions[fn]:
+                    if revision == revisions[fn]:
                         # Current! Count 100%.
                         stats += sizes[fn]
                     else:
-                        # SVN revision not current. Count 50%.
+                        # Git revision not current. Count 50%.
                         stats += sizes[fn]/2.
         value = float(stats)/(total/100.)
         print "%s: ~%d%% (~%.2f%%)." % (lng, int(round(value)), value)

Attachment: pgpJp_ZMQlg5c.pgp
Description: Signature digitale OpenPGP


Reply to: