main logo
Subject: [dabo-dev] dabo Commit 1232
Author: Paul McNett

Posted: 2005/08/31 12:53:41
 
View Entire Thread
New Search


dabo Commit
Revision 1232
Date: 2005-08-31 11:02:45 -0700 (Wed, 31 Aug 2005)
Author: paul

Changed:
U trunk/dabo/__version__.py

Log:
This fixes Dabo's __version__.py to accurately reflect Subversion's
revision number, if the client is using Dabo as a Subversion working
copy. Previously, if you were to check out an older revision, the
revision number wouldn't reflect that.


Diff:
Modified: trunk/dabo/__version__.py
===================================================================
--- trunk/dabo/__version__.py 2005-08-31 15:41:18 UTC (rev 1231)
+++ trunk/dabo/__version__.py 2005-08-31 18:02:45 UTC (rev 1232)
@@ -1,6 +1,30 @@
-from dabo.lib._daborevs import _revs
-_revision = _revs["dabo"]
+import os
+import dabo

+# If dabo is a subversion working copy, we'll try to get the current
+# revision using the svnversion command against that working copy.
+# Else, we'll get the revision as saved in _daborevs, which is an
+# external svn repository updated by a svn post-commit hook on the
+# server.
+daboPath = dabo.__path__[0]
+_revision = None
+olddir = os.getcwd()
+
+if os.path.exists(os.path.join(daboPath, ".svn")):
+ try:
+ os.chdir(daboPath)
+ _revision = os.popen("svnversion .").read().strip()
+ except:
+ pass
+ os.chdir(olddir)
+
+if _revision is None:
+ from dabo.lib._daborevs import _revs
+ _revision = _revs["dabo"]
+
version = {"version": "0.4.1",
"revision": _revision}

+if __name__ == "__main__":
+ print "Dabo Version: %s \n Revision: %s" % (
+ version["version"], version["revision"])





 
©2005 Paul McNett
<-- Prior Message New Search Next Message -->