use 'hg identify' to generate .hgrev file
authorKurt Smith <kwmsmith@gmail.com>
Thu, 29 Jul 2010 14:19:25 +0000 (09:19 -0500)
committerKurt Smith <kwmsmith@gmail.com>
Thu, 29 Jul 2010 14:19:25 +0000 (09:19 -0500)
setup.py

index 50ceaf06712cf054625a25a50bce10b10f3ed121..401a60fd825c36a9171c7c91518d614ff2035656 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -6,10 +6,9 @@ import sys
 if 'sdist' in sys.argv and sys.platform != "win32" and sys.version_info >= (2,4):
     # Record the current revision in .hgrev
     import subprocess # os.popen is cleaner but deprecated
-    changset = subprocess.Popen("hg log --rev tip | grep changeset", 
-                                shell=True,
-                                stdout=subprocess.PIPE).stdout.read()
-    rev = changset.decode('ISO-8859-1').split(':')[-1].strip()
+    changeset = subprocess.Popen("hg identify --id --rev tip".split(),
+                                 stdout=subprocess.PIPE).stdout.read()
+    rev = changeset.decode('ISO-8859-1').strip()
     hgrev = open('.hgrev', 'w')
     hgrev.write(rev)
     hgrev.close()