Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link rel="stylesheet" href="example.css?{% mercurial_revision "example.css" %}" />
- import subprocess
- def get_hg_rev(file_path):
- pipe = subprocess.Popen(
- ["hg", "log", "-l", "1", "--template", "{node}", file_path],
- stdout=subprocess.PIPE
- )
- return pipe.stdout.read()
- > path_to_file = "/home/jim/workspace/lgr/pinax/projects/lgr/site_media/base.css"
- > get_hg_rev(path_to_file)
- '0ed525cf38a7b7f4f1321763d964a39327db97c4'
- from mercurial import ui, hg
- from mercurial.node import hex
- repo = hg.repository('/path/to/repo/root', ui.ui())
- fctx = repo.filectx('/path/to/file', 'tip')
- hexnode = hex(fctx.node())
Add Comment
Please, Sign In to add comment