Adjust to modern mercurial version definition.
authorW. Trevor King <wking@drexel.edu>
Wed, 20 Jan 2010 14:27:16 +0000 (09:27 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 20 Jan 2010 14:27:16 +0000 (09:27 -0500)
commitd91aae83516d0326a0c4d19153f18d675674cc4c
tree7fdb1fd763c63b96ec436e9a17ca22bd489652db
parent4437e500b4ad6bf7c007d8207928b3b1b0c01d3c
Adjust to modern mercurial version definition.

  hg-stable$ hg log --patch mercurial/util.py
  ...
  changeset:   7640:9626819b2e3d
  user:        Matt Mackall <mpm@selenic.com>
  date:        Sat Jan 10 18:02:38 2009 -0600
  summary:     refactor version code

  diff --git a/mercurial/util.py b/mercurial/util.py
  --- a/mercurial/util.py
  +++ b/mercurial/util.py
  @@ -142,6 +142,14 @@
       """Find the length in characters of a local string"""
       return len(s.decode(_encoding, "replace"))

  +def version():
  +    """Return version information if available."""
  +    try:
  +        import __version__
  +        return __version__.version
  +    except ImportError:
  +        return 'unknown'
  +
   # used by parsedate
  ...
  hg-stable$ hg tags
  ...
  1.2                             7823:11efa41037e2
  1.1.2                           7497:11a4eb81fb4f
  ...
libbe/storage/vcs/hg.py