[application] allow to retrieve version using command line option

closes #145421

authorAlain Leufroy <alain.leufroy@logilab.fr>
changeset66055b7bdfbc
branchdefault
phasepublic
hiddenno
parent revision#c1cc5c806c53 [nested] be robust against .hgguestrepo parse errors (closes #234670)
child revision#b8aaf6d1bbaa [qt] install description.css as a example file
files modified by this revision
hgviewlib/application.py
# HG changeset patch
# User Alain Leufroy <alain.leufroy@logilab.fr>
# Date 1395252913 -3600
# Wed Mar 19 19:15:13 2014 +0100
# Node ID 66055b7bdfbcee8f15120fd820b7c587d5c31177
# Parent c1cc5c806c530bf2531dd2225a81c3ce256da7ae
[application] allow to retrieve version using command line option

closes #145421

diff --git a/hgviewlib/application.py b/hgviewlib/application.py
@@ -21,10 +21,11 @@
1  from optparse import OptionParser
2 
3  from mercurial import hg, ui as uimod
4  from mercurial.error import RepoError
5 
6 +from hgviewlib import __pkginfo__
7  from hgviewlib.util import find_repository, rootpath, build_repo
8  from hgviewlib.config import HgConfig
9 
10  class NullRepo(object):
11      """Placeholder repository"""
@@ -192,11 +193,11 @@
12 
13      - With -r option, starts in manifest viewer mode for given
14        revision.
15      '''
16 
17 -    parser = OptionParser(usage)
18 +    parser = OptionParser(usage, version=__pkginfo__.version)
19      parser.add_option('-I', '--interface', dest='interface',
20                        help=('which GUI interface to use (among "qt", "raw"'
21                               ' and "curses")'),
22                        )
23      parser.add_option('-R', '--repository', dest='repo',