DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:gource_analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
tips:gource_analysis [2010-05-16 15:41] – created 79.85.106.47tips:gource_analysis [2010-05-18 18:09] – oops - put "launch the script" back in 193.9.13.138
Line 1: Line 1:
 +====== Visualize Changes in Gource ======
  
 +I am fond of the wonderful videos made with [[http://code.google.com/p/gource/|Gource]]. This tool makes a representation of changes made on a version control system like git or SVN. Then I remember that DokuWiki is also a version control system like any other ... Just have a look in the folder tree to find the directory ''dokuwiki/data/meta'' in which the files ''*.changes'' contain exactly the information needed. 
  
-<code python>+ 
 +More information on this [[http://wolverinex02.blogspot.com/2010/05/gource-et-dokuwiki.html|blog]] (french version) or a translate version on this [[http://servalx02.blogspot.com/2010/05/gource-and-dokuwiki.html|blog]]. 
 + 
 +I wrote a small python script to generate logs from **.changes** files that can be used by Gource : 
 + 
 +<code python gourcedoku.py>
 #!/bin/python #!/bin/python
  
Line 25: Line 32:
        read them and output them in gource's log syntax        read them and output them in gource's log syntax
     """     """
 +    WHITE = "FFFFFF"
 +    GREEN = "00F000"
 +    start_page_name = "start"
     for root, dirs, files in os.walk(path):     for root, dirs, files in os.walk(path):
         for i in files:         for i in files:
Line 31: Line 41:
                 myfile = open(fichier, 'r')                 myfile = open(fichier, 'r')
                 for line in myfile.readlines():                 for line in myfile.readlines():
-                    mots = line.split() +                    mots = line.split('\t'
-                    if len(mots)>=5:+                    if len(mots)>=6:
                         resultat = mots[0] + "|"                         resultat = mots[0] + "|"
-                        resultat += mots[5] + "|"+                        if mots[4] == '': 
 +                            mots[4]  = 'Anonymous' 
 +                        resultat += mots[4] + "|"
                         resultat += translate(mots[2]) + "|"                         resultat += translate(mots[2]) + "|"
-                        resultat += fichier+                        resultat += mots[3].replace(':', '/'
 +                        if mots[3].rfind(start_page_name) == len(mots[3])-len(start_page_name): 
 +     resultat += "|" + WHITE 
 +                        else: 
 +                            resultat += "|" + GREEN
                         print resultat                         print resultat
-                    elif len(mots)==4:+                    else:
                         resultat = mots[0] + "|Anonymous|"                         resultat = mots[0] + "|Anonymous|"
                         resultat += translate(mots[2]) + "|"                         resultat += translate(mots[2]) + "|"
                         resultat += fichier                         resultat += fichier
 +                        resultat += "|FFFFFF"
                         print resultat                         print resultat
                 myfile.close()                 myfile.close()
Line 47: Line 64:
 def translate(mot): def translate(mot):
     """translate the dokuwiki vocabulary to the gource one     """translate the dokuwiki vocabulary to the gource one
-       C -> A +       (also cc and sc from discussion plugin) ->A 
-       E -> M+       (also ec from discussion plugin) -> M 
 +       D (also dc and hc from discssion plugin) -> D
        other -> M         other -> M 
     """     """
-    if mot == "C":+    if mot.upper == "C" or mot == 'cc' or mot == 'sc':
         return "A"         return "A"
-    elif mot == "E":+    elif mot.upper == "E" or mot == 'ec':
         return "M"         return "M"
 +    elif mot.upper == "D" or mot == 'dc' or mot == 'hc':
 +        return "D"
     else:     else:
         return "M"         return "M"
Line 90: Line 110:
 if __name__ == "__main__": if __name__ == "__main__":
     main(sys.argv[1:])     main(sys.argv[1:])
 +</code> 
 +launch the script inside your dokuwiki directory :  
 +<code bash>  
 +python gourcedoku.py -d ~/Sites/MyDokuwiki/ | sort > dokusort.log 
 +</code> 
 +then you can use Gource to watch logs : 
 +<code> 
 +gource --log-format custom dokusort.log --stop-position 1.0 --stop-on-idle --file-idle-time 10000000
 </code> </code>
tips/gource_analysis.txt · Last modified: 2010-05-20 15:53 by 193.9.13.135

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki