mercurial/util.py
changeset 7632 9626819b2e3d
parent 7559 016a7319e76b
child 7641 d2f753830f80
--- a/mercurial/util.py	Tue Jan 13 23:17:19 2009 +0100
+++ b/mercurial/util.py	Sat Jan 10 18:02:38 2009 -0600
@@ -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
 defaultdateformats = (
     '%Y-%m-%d %H:%M:%S',