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-16 18:08] – 84.132.240.227 | 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 34: | Line 68: | ||
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 |
- | resultat += mots[5] + " | + | """ |
- | resultat += translate(mots[2]) + " | + | |
- | resultat += fichier | + | |
- | print resultat | + | for line in myfile.readlines(): |
- | elif len(mots)==4: | + | mots = line.split(' |
- | | + | if len(mots)> |
- | resultat += translate(mots[2]) + " | + | resultat = mots[0] + " |
- | resultat += fichier | + | if mots[4] == '': |
- | print resultat | + | mots[4] |
- | myfile.close() | + | |
+ | resultat += translate(mots[2]) + " | ||
+ | resultat += mots[3].replace(' | ||
+ | | ||
+ | resultat | ||
+ | | ||
+ | | ||
+ | print resultat | ||
+ | myfile.close() | ||
def translate(mot): | def translate(mot): | ||
""" | """ | ||
- | C -> A | + | |
- | E -> M | + | |
+ | D (also dc and hc from discssion plugin) -> D | ||
other -> M | other -> M | ||
""" | """ | ||
- | if mot == " | + | if mot.upper |
return " | return " | ||
- | elif mot == " | + | elif mot.upper |
return " | return " | ||
+ | elif mot.upper == " | ||
+ | return " | ||
else: | else: | ||
return " | return " | ||
Line 76: | Line 122: | ||
sys.exit() | sys.exit() | ||
elif opt in (" | elif opt in (" | ||
- | print listdirectory2(arg) | + | print listdirectory(arg,WHITE) |
Line 97: | Line 143: | ||
</ | </ | ||
- | + | launch the script inside your dokuwiki directory : | |
- | launch the script inside your dokuwiki directory : | + | <code bash> |
- | <code bash> | + | |
python gourcedoku.py -d ~/ | python gourcedoku.py -d ~/ | ||
</ | </ |
tips/gource_analysis.1274026116.txt.gz · Last modified: 2010-05-16 18:08 by 84.132.240.227