[pypy-svn] pypy commit 1f81ed99bfbc: Improve handling of no tags and 'tip' for sys._mercurial

Bitbucket commits-noreply at bitbucket.org
Tue Dec 14 19:19:45 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pypy
# URL http://bitbucket.org/pypy/pypy/overview
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1292349066 -3600
# Node ID 1f81ed99bfbc17bbb3cc0920ac612218b4194f8c
# Parent  e7f4b203957094f99e65c80d803543f92c13dd9e
Improve handling of no tags and 'tip' for sys._mercurial

--- a/pypy/tool/version.py
+++ b/pypy/tool/version.py
@@ -23,13 +23,15 @@ def get_mercurial_info():
         hgid = p.stdout.read().strip()
 
         p = Popen([str(hgexe), 'id', '-t', pypyroot], stdout=PIPE, env=env)
-        hgtag = p.stdout.read().strip().split()[0]
+        hgtags = [t for t in p.stdout.read().strip().split() if t != 'tip']
 
-        if hgtag == 'tip':
+        if hgtags:
+            return 'PyPy', hgtags[0], hgid
+        else:
             # use the branch instead
             p = Popen([str(hgexe), 'id', '-b', pypyroot], stdout=PIPE, env=env)
-            hgtag = p.stdout.read().strip()
+            hgbranch = p.stdout.read().strip()
 
-        return 'PyPy', hgtag, hgid
+            return 'PyPy', hgbranch, hgid
     else:
         return None



More information about the Pypy-commit mailing list