Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / scripts / setup / ChangeLog.groovy @ 1000

History | View | Annotate | Download (2.5 kB)

1
package org.txm.scripts.setup
2

    
3
import org.txm.importer.ApplyXsl2;
4

    
5
// build log.xml
6
// cd /home/mdecorde/workspace37/org.txm.core
7
// svn log --xml --verbose > /home/mdecorde/workspace37/org.txm.core/log.xml
8
String home = System.getProperty("user.home")
9
File rootDir = new File(home, "SVN/TXMSVN")
10
File xsl = new File(home, "xsl/svn2cl.xsl")
11
File rawLogs = new File(home, "TEMP/portal_hist.txt")
12
File log = new File(home, "TEMP/log.txt")
13
File tbx = new File(home, "SVN/TXMSVN")
14

    
15
println "** FILES:"
16
println home
17
println rootDir
18
println xsl
19
println rawLogs
20
println log
21
println tbx
22

    
23
String dateLimit = "2014-01"
24
String revLimit = "1"
25

    
26
String cmd = """svn log --xml --verbose $tbx"""
27
println "\n** SVN LOG: "+cmd
28
def proc = cmd.execute()
29
rawLogs.withWriter("UTF-8") { writer -> writer.write(proc.in.getText()) }
30
proc.waitFor()
31
if (proc.exitValue() != 0) {
32
        println "SVN LOG error code: "+proc.exitValue()
33
        println "Error: "+proc.err.getText()
34
        return;
35
} 
36

    
37
println "** Filter XML : by date=$dateLimit and rev=$revLimit"
38
def slurper = new XmlParser();
39
def root = slurper.parse(rawLogs.toURI().toString())
40
log.withWriter("UTF-8") { writer ->
41
        for (def entry : root.logentry) {
42
                String rev = entry.@revision
43
                if (rev.compareTo(revLimit) < 0) continue
44
                def msgs = entry.msg
45
                
46
                for (def date : entry.date) {
47
                        String sdate = date.text()
48
                        if (sdate.compareTo(dateLimit) < 0) {
49
                                return
50
                        }
51
                        writer.print("* "+sdate.substring(0, 10) + " - " + (sdate.substring(11, 19)))+ " REV "+rev
52
                }
53
                
54
                boolean first = true;
55
                for (def msg : msgs) {
56
                        String smsg = msg.text().trim()
57
                        if (smsg.length() == 0) continue;
58
                        if (first) { first = false; smsg = "\n"+smsg; }
59
                        smsg = smsg.replace("\nRCP", "\n** RCP")
60
                        smsg = smsg.replace("\nTBX", "\n** TBX")
61
                        smsg = smsg.replace("\nPLUGIN", "\n** PLUGIN")
62
                        smsg = smsg.replace("\nWEB", "\n** WEB")
63
                        smsg = smsg.replace("\nSETUP", "\n** SETUP")
64
                        smsg = smsg.replace("\nDOC", "\n** DOC")
65
                        smsg = smsg.replace("\nTRA", "\n** TRA")
66
                        smsg = smsg.replace("\nCQP", "\n** CQP")
67
                        smsg = smsg.replace("\nCWB", "\n** CQP")
68
                        smsg = smsg.replace("\nINSTALL", "\n** INSTALL")
69
                        smsg = smsg.replace("\nR textometry", "\n** R textometry")
70
                        smsg = smsg.replace(" :", ":") // hahaha
71
                        smsg = smsg.replace("textoemtry", "textometry") // hohoho
72
                        smsg = smsg.replace("# ", "*** ")
73
                        smsg = smsg.replace("#([0-9]+)", "[https://forge.cbp.ens-lyon.fr/redmine/issues/${1} #{1}]")
74
                        writer.print smsg
75
                }
76
                writer.println ""
77
        }
78
}
79

    
80
println "RESULT SAVED IN : "+log.toURI()