changeset b88edb9f3333 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=b88edb9f3333
description:
        SCons: Fix how we get Mercurial revision information since internals 
keep changing.

diffstat:

2 files changed, 8 insertions(+), 22 deletions(-)
src/SConscript        |   24 ++++++------------------
src/python/m5/main.py |    6 ++----

diffs (75 lines):

diff -r 9f7efe90084e -r b88edb9f3333 src/SConscript
--- a/src/SConscript    Fri Jan 30 20:04:17 2009 -0500
+++ b/src/SConscript    Fri Jan 30 20:04:57 2009 -0500
@@ -355,25 +355,16 @@
 
 scons_dir = str(SCons.Node.FS.default_fs.SConstruct_dir)
 
-hg_info = ("Unknown", "Unknown", "Unknown")
+hg_info = "Unknown"
 hg_demandimport = False
 try:
     if not exists(scons_dir) or not isdir(scons_dir) or \
            not exists(joinpath(scons_dir, ".hg")):
         raise ValueError(".hg directory not found")
-
-    import mercurial.demandimport, mercurial.hg, mercurial.ui
-    import mercurial.util, mercurial.node
-    hg_demandimport = True
-
-    repo = mercurial.hg.repository(mercurial.ui.ui(), scons_dir)
-    rev = mercurial.node.nullrev + repo.changelog.count()
-    changenode = repo.changelog.node(rev)
-    changes = repo.changelog.read(changenode)
-    id = mercurial.node.hex(changenode)
-    date = mercurial.util.datestr(changes[2])
-
-    hg_info = (rev, id, date)
+    import subprocess    
+    output = subprocess.Popen("hg id -n -i -t -b".split(), 
+                              stdout=subprocess.PIPE).communicate()[0]
+    hg_info = output.strip()
 except ImportError, e:
     print "Mercurial not found"
 except ValueError, e:
@@ -381,16 +372,13 @@
 except Exception, e:
     print "Other mercurial exception: %s" % e
 
-if hg_demandimport:
-    mercurial.demandimport.disable()
-
 # Generate Python file containing a dict specifying the current
 # build_env flags.
 def makeDefinesPyFile(target, source, env):
     f = file(str(target[0]), 'w')
     build_env, hg_info = [ x.get_contents() for x in source ]
     print >>f, "buildEnv = %s" % build_env
-    print >>f, "hgRev, hgId, hgDate = %s" % hg_info
+    print >>f, "hgRev = '%s'" % hg_info
     f.close()
 
 defines_info = [ Value(build_env), Value(hg_info) ]
diff -r 9f7efe90084e -r b88edb9f3333 src/python/m5/main.py
--- a/src/python/m5/main.py     Fri Jan 30 20:04:17 2009 -0500
+++ b/src/python/m5/main.py     Fri Jan 30 20:04:57 2009 -0500
@@ -192,8 +192,7 @@
         print 'Build information:'
         print
         print 'compiled %s' % defines.compileDate;
-        print "revision %s:%s" % (defines.hgRev, defines.hgId)
-        print "commit date %s" % defines.hgDate
+        print "revision %s" % defines.hgRev
         print 'build options:'
         keys = defines.buildEnv.keys()
         keys.sort()
@@ -268,8 +267,7 @@
         print
 
         print "M5 compiled %s" % defines.compileDate;
-        print "M5 revision %s:%s" % (defines.hgRev, defines.hgId)
-        print "M5 commit date %s" % defines.hgDate
+        print "M5 revision %s" % defines.hgRev
 
         print "M5 started %s" % datetime.datetime.now().strftime("%b %e %Y %X")
         print "M5 executing on %s" % socket.gethostname()
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to