#NEWLINE# def get_version( ) : #NEWLINE# #INDENT# 'Returns the version as a human-format string.' #NEWLINE# hg_rev = 'hg-unknown' #NEWLINE# v = '.' . join ( [ str ( i ) for i in VERSION [ : ( - 1 ) ] ] ) #NEWLINE# if VERSION [ ( - 1 ) ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# import os #NEWLINE# from mercurial import ui , hg #NEWLINE# dir = os . path . dirname ( __file__ ) #NEWLINE# hg_dir = os . path . normpath ( os . path . join ( dir , '../../../' ) ) #NEWLINE# repo = hg . repository ( ui . ui ( ) , dir ) #NEWLINE# c = repo [ 'tip' ] #NEWLINE# hg_rev = ( 'hg-%s:%s' % ( c . rev ( ) , c . hex ( ) [ 0 : 12 ] ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# v = ( '%s-%s %s' % ( v , VERSION [ ( - 1 ) ] , hg_rev ) ) #NEWLINE# #UNINDENT# return v