František Žiačik
František Žiačik

Reputation: 7614

Display mercurial version with CGI

I'm using mercurial on a shared hosting with hgwebdir cgi script.

Sometimes I'd like to check which version of mercurial is there installed on the server. Is there any way to display mercurial version using CGI (like output of hg --version)?

Upvotes: 2

Views: 100

Answers (1)

Tyler Smith
Tyler Smith

Reputation: 1279

https://www.mercurial-scm.org/wiki/ReferenceCycles

from mercurial import hg, ui, util
import os
import gc

def test():
    print "Mercurial version: %s" % util.version()
    repo = hg.repository(ui.ui(), os.getcwd())
    status = repo.status()
    print status

test()
print "gc.collect() returns %s" % gc.collect()

Upvotes: 2

Related Questions