2011-01-16 2 views
2

저는 Python IDE를위한 Mercurial 지원 플러그인을 만들려고하고 있는데, API를 이해하는 데 많은 어려움이 있습니다. 지금 나는 API의 다른 명령의 사용법을 이해하기위한 실험 만하고 있지만 api의 문서 나 그와 비슷한 것을 찾을 수는 없습니다.Mercurial API : repo.changectx (변경)가 존재하지 않습니다!

내 문제는 r에이 작업이 없기 때문에 r.changectx가 작동하지 않는다는 것입니다. 그리고 나는 changectx 함수를 사용하는 많은 예제를 보았습니다.

내 수은 버전은 1.7.3입니다. 고마워요 !!

from mercurial import ui, hg 


r = hg.repository(ui.ui(), "https://ninja-ide.googlecode.com/hg/") 
c = r.changectx("setup.py") 

# show some information about the changeset 
print C# represented as the changeset hash 
print c.user() 
print c.description() 
print 

# let's take a peek at the files 
files = c.files() 
for f in files: 
fc = c[f] 
print " ", f, len(fc.data()) 

답변

3

나는 그것이 그렇게 작동하기 위해서는 로컬 레포가 필요하다고 생각합니다. 또한 changectx에 대한 개정이 필요합니다.

from mercurial import ui, hg, commands 

myui = ui.ui() 
repourl = "https://ninja-ide.googlecode.com/hg/" 

commands.clone(myui, repourl, 'ninja') 
r = hg.repository(myui, './ninja') 
c = r.changectx("tip") 

# show some information about the changeset 
print C# represented as the changeset hash 
print c.user() 
print c.description() 
print 

# let's take a peek at the files 
files = c.files() 
for f in files: 
fc = c[f] 
print " ", f, len(fc.data()) 

편집 : this FAQ entry는 원격 저장소에서 작동하지 않습니다 것을 확증하는 것 같다.

+1

고마워요. D, 완벽하게 작동합니다! 어디에서 Mercurial API에 대한 완전한 (또는 거의) 문서를 찾을 수 있는지 알고 있습니까? – DraskyVanderhoff

+0

다시 한번 감사드립니다 :) – DraskyVanderhoff