Skip to content

Instantly share code, notes, and snippets.

@troter
Created September 18, 2011 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troter/1225257 to your computer and use it in GitHub Desktop.
Save troter/1225257 to your computer and use it in GitHub Desktop.
mercurialの内部APIを利用してファイルのコンテンツをとる
import os
from mercurial import hg, ui
path = "/home/takumi/"
repo = hg.repository(ui.ui(), path)
ctx = repo['tip']
#print ctx.filectx('.zshenv').data()
mf = ctx.manifest()
rootfiles = []
for f, n in mf.iteritems():
if os.path.dirname(f) == '':
rootfiles.append(f)
for f in rootfiles:
print f
print ctx.filectx(f).data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment