Subversionã使ã£ã¦ã½ã¼ã¹ã³ã¼ãããã¼ã¸ã§ã³ç®¡çãã¦ãããã§ãããããã使ã£ã¦(主ã«èªåç¨ã®)èªåè¨æ¸¬ã®çä¼¼äºã§ãåºæ¥ãªãããªï¼ã¨æã£ã訳ã§ããã§ãSubversion APIã使ã£ã¦ã¿ããã¨æãã¾ããã
- å¤ã§ãã¢ããµã : pysvn - Subversion APIãpythonãã使ã
http://assam-at-night.blogspot.com/2007/10/pysvn-subversion-apipython.html - ã ããã: Subversionç¨API
http://www.darari.com/2007/11/subversionapi.html
ãããè¦ãã¨ãSubversionã«ã¢ã¯ã»ã¹ããAPIããããPythonåãã®ãã¤ã³ãã£ã³ã°ã¨ã㦠pysvn ãããããã§ãã®ã§ãããã使ã£ã¦æ
å ±ãåå¾ãã¦ã¿ã¾ãããã
ãã¦ã³ãã¼ã
æåè¿·ã£ãã®ããSubversionã®æ¬å®¶ãã¦ã³ãã¼ãã¨pysvnã®ãã¦ã³ãã¼ãã®ãã©ã¡ãããã©ã¤ãã©ãªããã¦ã³ãã¼ãããæ¹ãè¯ãã®ãï¼ã¨ããç¹ã§ããã
- subversion: Subversion Packages
http://subversion.tigris.org/project_packages.html - pysvn: Downloads
http://pysvn.tigris.org/project_downloads.html
Subversionæ¬å®¶ãè¦ãã¨ãsvn-win32-1.5.5_py25.zip
ãã£ã¦ã®ããã£ã¦ãã³ã¡ã³ãã«ãPython 2.5 bindings for Subversion on Win32.ãã£ã¦æ¸ãã¦ãããã§ããã
ãã£ã¡ã§ãOKãªã®ããªãï¼ã¨æã£ã¦è©¦ãã«ãã¦ã³ãã¼ããã¦èª¿ã¹ã¦ã¿ããããã£ã¡ã¯ã»ããã¢ãã(setup.pyã¨ã)ãããã¾ããã§ããã
ã§ãpysvnã®æ¹ã¯ãã»ããã¢ãããæºåããã¦ããããã§ãã®ã§ããã¡ãã使ã£ãæ¹ã楽ã ã¨æãã¾ãã
èªåã¯ã'py26-pysvn-svn153-1.6.2-1067.exe
'ããã¦ã³ãã¼ãï¼ã¤ã³ã¹ãã¼ã«ãã¾ããã
(ã¤ã³ã¹ãã¼ã«ã¯ããã¡ã¤ã«ãããã«ã¯ãªãã¯ããã ã)
è³æ
Subversionã®ãªãã¸ããªãã¢ã¯ã»ã¹ããAPIã®è³æã¨ãã¦ã¯ã以ä¸ãããããã§ãã
- pysvn Programmer's Guide
http://pysvn.tigris.org/docs/pysvn_prog_guide.html - pysvn: pysvn - Programmer's reference
http://pysvn.tigris.org/docs/pysvn_prog_ref.html
å¾ã¯ã以ä¸ã§ã²ããã§ããSubversionã®CHMãã¡ã¤ã«ä¸ã®ã第8ç« éçºè ã®æ å ±ããè¯ãã®ããªãï¼ã¨æã£ã¦ãã¾ãã
- Subversion Bookã®CHMãã¡ã¤ã«ãå
Ž - Sarabande
http://sarabande.info/2008/02/11/svnbook-chm/
è¦ãéãããªãã¡ã¬ã³ã¹ãè¦ãªãã ããããåãã¦ããããä½ã¨ããªãããªãï¼ã¨ããã¬ãã«ã§ããã
ããã§ã¯ã以éã§ç°¡åãªã³ã¼ãã示ãã¦è¦ã¾ãã
ãã¡ã¤ã«ã®æ å ±ãå¾ã
ã¾ããä½æ¥ä¸ã®ãã¡ã¤ã«ã®æ
å ±ãå¾ã¾ãããã
ãããã¡ã¤ã«ã®æ
å ±ãå¾ãã«ã¯ã'pysvn.Client.info
'ã¡ã½ããã§OKã®ããã§ãã
#!/bin/env python # -*- encoding: cp932 -*- import pysvn import time client = pysvn.Client() fpath = r"F:\Wacky\test2\Python\20090104.pysvn\test1.py" o = client.info(fpath) for i in o: if i.find("time") >= 0: print i, ":", time.ctime(o[i]) elif i.find("revision") >= 0: print i, ":", o[i].number else: print i,":", o[i]
å®è¡ããã¨ã以ä¸ã®ãããªæãã«ãªãã¾ãã
F:\Wacky\test2\Python\20090104.pysvn>python test3.py is_absent : 0 properties_time : Thu Jan 01 09:00:00 1970 conflict_old : None commit_author : wacky schedule : normal repos : file:///C:/svn/code_sample2 copy_from_url : None is_copied : 0 lock_owner : None copy_from_revision : -1 property_reject_file : None lock_creation_date : 0.0 conflict_work : None kind : file lock_token : None text_time : Sun Jan 11 23:58:35 2009 lock_comment : None is_deleted : 0 uuid : None url : file:///C:/svn/code_sample2/trunk/Python/20090104.pysvn/test1.py checksum : f3501216e850cf2db0b0f3138814ae77 commit_revision : 47 name : test1.py conflict_new : None commit_time : Mon Jan 12 14:24:15 2009 revision : 47
ã¡ãªã¿ã«ãæ¥æ(time)ã®åå¾æãtime.ctimeã¡ã½ããã使ã£ã¦æµ®åå°æ°ç¹æ°âæ¥æå¤æãã¦ãã¾ãã
ãã¡ã¤ã«è¡æ°ãå¾ã
ãããã¡ã¤ã«ã®è¡æ°(LOC)ãå¾ãã«ã¯ã'pysvn.Client.cat
'ã¡ã½ããã§åå¾ããããã¹ãæååãããstring.splitlines ã¡ã½ããã使ã£ã¦æ¹è¡æ°ãã«ã¦ã³ãããã°è¯ãã§ãããã
#!/bin/env python # -*- encoding: cp932 -*- import pysvn client = pysvn.Client() fpath = r"F:\Wacky\test2\Python\20090104.pysvn\test1.py" txt = client.cat(fpath) print "LOC:", len(txt.splitlines())
å®è¡ããã¨ã以ä¸ã®ããã«ãªãã¾ãã
F:\Wacky\test2\Python\20090104.pysvn>python test4.py LOC: 41
ãã°æ å ±ãå¾ã
éå»ã®ãã§ãã¯ã¤ã³ã®ãã°ãå¾ãã«ã¯ã'pysvn.Client.log
'ã¡ã½ããã§åå¾ã§ããããã§ãã
#!/bin/env python # -*- encoding: cp932 -*- import pysvn import time client = pysvn.Client() fpath = r"F:\Wacky\test2\Python\20090104.pysvn\test1.py" entry_list = client.log(fpath) print "entry_list count:", len(entry_list) for v in entry_list: print "-----" print "revision:", v["revision"].number print "author:", v["author"] print "date:", time.ctime(v["date"]) print "message:[%s]" % v["message"]
å®è¡ããã¨ã以ä¸ã®ããã«ãªãã¾ãã
F:\Wacky\test2\Python\20090104.pysvn>python test5.py entry_list count: 2 ----- revision: 47 author: wacky date: Mon Jan 12 14:24:15 2009 message:[hello python ] ----- revision: 46 author: wacky date: Sun Jan 04 19:34:24 2009 message:[]
ãªãã¸ããªã®å ¨ãã¡ã¤ã«ãªã¹ãåºå
ãªãã¸ããªã®å
¨ãã¡ã¤ã«ãªã¹ããåºåããã«ã¯ã'pysvn.Client.root_url_from_path
'ã¡ã½ããã§ãªãã¸ããªã®ã«ã¼ããåå¾ãã¦ã'pysvn.Client.ls
'ã¡ã½ããã§ãã¡ã¤ã«ãªã¹ããå¾ãã°OKã¿ããã§ãã
#!/bin/env python # -*- encoding: cp932 -*- import pysvn client = pysvn.Client() def ls_walk(ary): unification = { 0x2014: 0x2015, # HORIZONTAL BAR 0xFF5E: 0x301C, # WAVE DASH 0x2225: 0x2016, # DOUBLE VERTICAL LINE 0x22EF: 0x2026, # HORIZONTAL ELLIPSIS 0xFF0D: 0x2212, # MINUS SIGN 0xFFE0: 0x00A2, # CENT SIGN 0xFFE1: 0x00A3, # POUND SIGN 0xFFE2: 0x00AC # NOT SIGN } for v in ary: print "name:", v["name"].translate(unification) if v["kind"] == pysvn.node_kind.dir: ls_walk(client.ls(v["name"])) print "list tree" fpath = r"F:\Wacky\test2\Python\20090104.pysvn\test1.py" rpath = client.root_url_from_path(fpath) print rpath entry_list = client.ls(rpath) ls_walk(entry_list)
å®è¡ããã¨ã以ä¸ã®ãããªæãã«ãªãã¾ãã
... name: file:///C:/svn/code_sample2/trunk/VS/20081124.HyperEstraierã®ãã¤ã³ã ã£ã³ã°ãä½ã2/test_app2/Program.cs name: file:///C:/svn/code_sample2/trunk/VS/20081124.HyperEstraierã®ãã¤ã³ã ã£ã³ã°ãä½ã2/test_app2/Properties name: file:///C:/svn/code_sample2/trunk/VS/20081124.HyperEstraierã®ãã¤ã³ã ã£ã³ã°ãä½ã2/test_app2/Properties/AssemblyInfo.cs name: file:///C:/svn/code_sample2/trunk/VS/20081124.HyperEstraierã®ãã¤ã³ã ã£ã³ã°ãä½ã2/test_app2/test_app2.csproj
ãªãã¸ããªã®ãã¹ãå¾ãæãåã«print表示ããã« translate ã¡ã½ããã使ã£ã¦å¤æ表示ãã¦ãã¾ã(ãprint "name:", v["name"].translate(unification)
ãã®æ)ã
ããã¯ãunicodeæååããcp932ã«å¤æããéã®ä¸ç¨®ã®ãã¯ããã¯ã§ãã詳ããã¯ã以ä¸ãã©ããã
- UnicodeEncodeError:ã§ããã - while( life != end ){ do( enjoy ); }
http://d.hatena.ne.jp/hirothin/20080819/1219123920 - Python bite: æåéåé対å¿æåã®å¤æ | Inside ASCADE
http://inside.ascade.co.jp/node/44 - ãã ããPython(è¶
åå¿è
ç¨)ããã®2
http://pc11.2ch.net/test/read.cgi/tech/1218155094/491
ææ³
æå¤ã¨ç°¡åã«ãªãã¸ããªãæä½åºæ¥ãã®ã§ããã¯ãªãã¾ããã
ããã§æ
å ±ãã°ã©ãåããããé¢ç½ãè¨æ¸¬ãã¼ã¿ãåããããªï¼
ä½è«ã§ãããéçºã«ãããèªåè¨æ¸¬(metrics)åéãè¡ããããªãã(å¨å²ãå°å
¥ã«ç解ãããã¨ãå人ã§éç¨å®æ½å¯è½ãªã)Tracã¨ãRedmineãå
¥ãã¦ãã¾ã£ãæ¹ãç¾å®çã ã¨æãã¾ãã
åç¨ãªãVSTS(TFS), ClearCaseã§ãããï¼VSTS㯠ä¸åº¦ä½¿ã£ã¦ã¿ãããªããCodePlexãTFSã§æ§ç¯ããã¦ãããããªã®ã§ãTeam Explorer Clientå
¥ããã°ä½é¨å¯è½ããªãï¼
(90æ¥è©ä¾¡çã¯ãããã©ã空æ°ã®ããã«æ¥ã
使ããªãã¨æ¬æ°ã§å°å
¥ãããã¨ããæèä»ããåããªããã§ããã)