tips:gource_analysis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:gource_analysis [2010-05-17 17:57] – correct the code for "delete" 193.9.13.136 | tips:gource_analysis [2010-05-20 15:53] (current) – some versions of gource need RGB hex colour to be in upper case 193.9.13.135 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | I am fond of the wonderful videos made with 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 | + | ====== Visualize Changes in Gource ====== |
+ | |||
+ | I am fond of the wonderful videos made with [[http:// | ||
Line 18: | Line 20: | ||
""" | """ | ||
+ | import glob | ||
import os.path | import os.path | ||
import getopt | import getopt | ||
Line 24: | Line 26: | ||
import re | import re | ||
+ | WHITE = " | ||
+ | GREEN = " | ||
+ | vector = (1,10,100) | ||
+ | start_page_name = " | ||
+ | def RGBToHTMLColor(rgb_tuple): | ||
+ | """ | ||
+ | hexcolor = '# | ||
+ | # that's it! ' | ||
+ | return hexcolor | ||
+ | |||
+ | def HTMLColorToRGB(colorstring): | ||
+ | """ | ||
+ | colorstring = colorstring.strip() | ||
+ | if colorstring[0] == '#': | ||
+ | if len(colorstring) != 6: | ||
+ | raise ValueError, "input #%s is not in #RRGGBB format" | ||
+ | r, g, b = colorstring[: | ||
+ | r, g, b = [int(n, 16) for n in (r, g, b)] | ||
+ | return (r, g, b) | ||
+ | |||
+ | def colormodify(colorstring): | ||
+ | rgb_tuple = HTMLColorToRGB(colorstring) | ||
+ | r, g, b = (rgb_tuple[0]+vector[0]) % 255, | ||
+ | return RGBToHTMLColor((r, | ||
+ | |||
+ | def listdirectory(path, | ||
+ | l = glob.glob(path+"/ | ||
+ | for i in l: | ||
+ | if os.path.isdir(i): | ||
+ | listdirectory(i, | ||
+ | else: | ||
+ | readfile(i, | ||
def listdirectory2(path): | def listdirectory2(path): | ||
Line 30: | Line 64: | ||
read them and output them in gource' | read them and output them in gource' | ||
""" | """ | ||
- | WHITE = " | ||
- | GREEN = " | ||
- | start_page_name = " | ||
for root, dirs, files in os.walk(path): | for root, dirs, files in os.walk(path): | ||
for i in files: | for i in files: | ||
if (re.search(' | if (re.search(' | ||
fichier = os.path.join(root, | fichier = os.path.join(root, | ||
- | myfile = open(fichier, | + | |
- | for line in myfile.readlines(): | + | |
- | mots = line.split(' | + | def readfile(fichier, |
- | if len(mots)> | + | """ |
- | resultat = mots[0] + " | + | file a log line for Gource |
- | if mots[4] == '': | + | """ |
- | mots[4] | + | |
- | resultat += mots[4] + " | + | |
- | resultat += translate(mots[2]) + " | + | for line in myfile.readlines(): |
- | resultat += mots[3].replace(':', | + | mots = line.split(' |
- | if mots[3].rfind(start_page_name) == len(mots[3])-len(start_page_name): | + | if len(mots)> |
- | | + | resultat = mots[0] + " |
- | else: | + | if mots[4] == '': |
- | resultat += " | + | mots[4] |
- | print resultat | + | resultat += mots[4] + " |
- | else: | + | resultat += translate(mots[2]) + " |
- | resultat = mots[0] + " | + | resultat += mots[3].replace(':', |
- | resultat += translate(mots[2]) + " | + | if mots[3].rfind(start_page_name) == len(mots[3])-len(start_page_name): |
- | resultat += fichier | + | resultat += " |
- | resultat += " | + | else: |
- | print resultat | + | resultat += " |
- | myfile.close() | + | print resultat |
+ | myfile.close() | ||
def translate(mot): | def translate(mot): | ||
Line 89: | Line 122: | ||
sys.exit() | sys.exit() | ||
elif opt in (" | elif opt in (" | ||
- | print listdirectory2(arg) | + | print listdirectory(arg,WHITE) |
Line 108: | Line 141: | ||
if __name__ == " | if __name__ == " | ||
main(sys.argv[1: | main(sys.argv[1: | ||
+ | |||
+ | </ | ||
+ | launch the script inside your dokuwiki directory : | ||
+ | <code bash> | ||
+ | python gourcedoku.py -d ~/ | ||
</ | </ | ||
then you can use Gource to watch logs : | then you can use Gource to watch logs : |
tips/gource_analysis.txt · Last modified: 2010-05-20 15:53 by 193.9.13.135