[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ Merged changes
from the trunk (rev. 25322):
Dmitry Vasiliev
dima at hlabs.spb.ru
Thu Jun 10 03:49:22 EDT 2004
Log message for revision 25323:
Merged changes from the trunk (rev. 25322):
ZopeVersion now know about Subversion
-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt 2004-06-10 07:45:41 UTC (rev 25322)
+++ Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt 2004-06-10 07:49:21 UTC (rev 25323)
@@ -18,8 +18,24 @@
- utilities/runurl.py hadn't been updated to relect recent
changes in the debugging support.
+ - Views for I18nFile/I18nImage now use contentType attribute instead
+ of outdated getContentType method.
+
+ - ZopeVersion now know about Subversion.
+
Restructuring
+ Much thanks to everyone who contributed to this release:
+
+ Jim Fulton, Marius Gedminas, Fred Drake, Philipp von Weitershausen,
+ Stephan Richter, Dmitry Vasiliev, Scott Pascoe, Bjorn Tillenius,
+ Eckart Hertzler, Roger Ineichen, Stuart Bishop
+
+ Note: If you are not listed and contributed, please add yourself. This
+ note will be deleted before the release.
+
+ ------------------------------------------------------------------
+
Zope X3.0.0 Beta 1
New features
@@ -106,9 +122,6 @@
Stephan Richter, Dmitry Vasiliev, Scott Pascoe, Bjorn Tillenius,
Eckart Hertzler, Roger Ineichen, Stuart Bishop
- Note: If you are not listed and contributed, please add yourself. This
- note will be deleted before the release.
-
------------------------------------------------------------------
Zope X3.0.0 Alpha 2
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_zopeversion.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_zopeversion.py 2004-06-10 07:45:41 UTC (rev 25322)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_zopeversion.py 2004-06-10 07:49:21 UTC (rev 25323)
@@ -40,8 +40,8 @@
f.write("\n")
f.close()
if tag:
- os.mkdir(os.path.join(self.tmpdir, "CVS"))
- f = open(os.path.join(self.tmpdir, "CVS", "Tag"), "w")
+ os.mkdir(os.path.join(self.tmpdir, ".svn"))
+ f = open(os.path.join(self.tmpdir, ".svn", "entries"), "w")
f.write(tag)
if not tag.endswith("\n"):
f.write("\n")
@@ -53,65 +53,68 @@
def test_IVerify(self):
verifyObject(IZopeVersion, self._Test__new())
- # CVS/Tag lines can start with different characters, each of which
- # has some meaning:
- # D - checked out with a date; format is YYYY.MM.DD.HH.MM.SS
- # where HH.MM.SS indicates timezone (04.00.00 is GMT - 4 hours)
- # N - checked out with a non-branch tag; format is Ntagname
- # T - checked out with a branch tag; format is Ttagname
+ # In .svn/entries we check only two attributes:
+ # 'url' - repository path
+ # 'revision' - checked out revision number
def test_ZopeVersion(self):
self.prepare(None, None)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(), "Development/Unknown")
- def test_ZopeVersion_cvsdate(self):
- self.prepare(None, "D2004.04.30.04.00.00")
+ def test_ZopeVersion_svntrunk(self):
+ self.prepare(None, """
+ url="svn+ssh://svn.zope.org/repos/main/Zope3/trunk/src/zope"
+ revision="10000"
+ """)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (2004.04.30.04.00.00)")
+ "Development/Revision: 10000")
- def test_ZopeVersion_cvstag(self):
- self.prepare(None, "Nsome-tag")
+ def test_ZopeVersion_svnbranch(self):
+ self.prepare(None, """
+ url="svn+ssh://svn.zope.org/repos/main/Zope3/branches/Zope3-1.0/src/zope"
+ revision="10000"
+ """)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (some-tag)")
+ "Development/Revision: 10000/Branch: Zope3-1.0")
- def test_ZopeVersion_cvsbranchtag(self):
- self.prepare(None, "Tsome-tag")
+ def test_ZopeVersion_svntag(self):
+ self.prepare(None, """
+ url="svn+ssh://svn.zope.org/repos/main/Zope3/tags/Zope3-1.0/src/zope"
+ revision="10000"
+ """)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (some-tag)")
+ "Development/Revision: 10000/Tag: Zope3-1.0")
- def test_ZopeVersion_release(self):
- self.prepare("Zope X3 1.0.1a1", None)
+ def test_ZopeVersion_svn_unknown(self):
+ self.prepare(None, "")
zope_version = self._Test__new()
- self.assertEqual(zope_version.getZopeVersion(),
- "Zope X3 1.0.1a1")
+ self.assertEqual(zope_version.getZopeVersion(), "Development/Unknown")
- def test_ZopeVersion_release_cvsdate(self):
- # demonstrate that the version.txt data is discarded if
- # there's revision-control metadata:
- self.prepare("Zope X3 1.0.1a1", "D2004.04.30.04.00.00")
+ def test_ZopeVersion_release(self):
+ self.prepare("Zope 3 1.0.0", None)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (2004.04.30.04.00.00)")
+ "Zope 3 1.0.0")
- def test_ZopeVersion_release_cvstag(self):
- # demonstrate that the version.txt data is discarded if
- # there's revision-control metadata:
- self.prepare("Zope X3 1.0.1a1", "Nsome-tag")
+ def test_ZopeVersion_release_empty(self):
+ self.prepare(" ", None)
zope_version = self._Test__new()
- self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (some-tag)")
+ self.assertEqual(zope_version.getZopeVersion(), "Development/Unknown")
- def test_ZopeVersion_release_cvsbranchtag(self):
+ def test_ZopeVersion_release_svntrunk(self):
# demonstrate that the version.txt data is discarded if
# there's revision-control metadata:
- self.prepare("Zope X3 1.0.1a1", "Tsome-tag")
+ self.prepare("Zope 3 1.0.0", """
+ url="svn+ssh://svn.zope.org/repos/main/Zope3/trunk/src/zope"
+ revision="10000"
+ """)
zope_version = self._Test__new()
self.assertEqual(zope_version.getZopeVersion(),
- "Development/Unknown (some-tag)")
+ "Development/Revision: 10000")
def test_suite():
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/zopeversion.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/zopeversion.py 2004-06-10 07:45:41 UTC (rev 25322)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/zopeversion.py 2004-06-10 07:49:21 UTC (rev 25323)
@@ -16,6 +16,7 @@
$Id$
"""
import os
+import re
import zope
from zope.app.applicationcontrol.interfaces import IZopeVersion
@@ -24,6 +25,9 @@
class ZopeVersion(object):
implements(IZopeVersion)
+ __entries = re.compile(r'(url|revision)\s*=\s*"([^"]+)"')
+ __tags = re.compile(r'/(tags|branches)/([^/]+)/')
+
def __init__(self, path=None):
if path is None:
path = os.path.dirname(os.path.abspath(zope.__file__))
@@ -35,33 +39,50 @@
if self.result is not None:
return self.result
- version_id = "Development/Unknown"
- version_tag = ""
- is_cvs = False
+ self.result = "Development/Unknown"
- # is this a CVS checkout?
- # XXX need to change this when we move to Subversion
- cvsdir = os.path.join(self.path, "CVS" )
- if os.path.isdir(cvsdir):
- is_cvs = True
- tagfile = os.path.join(cvsdir, "Tag")
+ # is this a SVN checkout?
+ svndir = os.path.join(self.path, ".svn")
+ if os.path.isdir(svndir):
+ self.__setSVNVersion(svndir)
+ else:
+ # try to get official Zope release information
+ versionfile = os.path.join(self.path, "version.txt")
+ if os.path.isfile(versionfile):
+ f = file(versionfile)
+ self.result = f.readline().strip() or self.result
+ f.close()
+ return self.result
- # get the tag information
- if os.path.isfile(tagfile):
- f = open(tagfile)
- tag = f.readline().rstrip()
+ def __setSVNVersion(self, svndir):
+ entriesfile = os.path.join(svndir, "entries")
+
+ # get the version information
+ if os.path.isfile(entriesfile):
+ f = file(entriesfile)
+ url, revision = "", ""
+ for line in f:
+ match = self.__entries.search(line)
+ if match is not None:
+ name, value = match.group(1, 2)
+ if name == "url":
+ url = value
+ elif name == "revision":
+ revision = value
+ if url and revision:
+ break
f.close()
- if tag[:1] in ("D", "N", "T"):
- version_tag = " (%s)" % tag[1:]
- # try to get official Zope release information
- versionfile = os.path.join(self.path, "version.txt")
- if os.path.isfile(versionfile) and not is_cvs:
- f = open(versionfile)
- version_id = f.readline().strip() or version_id
- f.close()
+ if revision and url:
+ match = self.__tags.search(url)
+ tag = ""
+ if match is not None:
+ type, value = match.group(1, 2)
+ if type == "tags":
+ tag = "/Tag: %s" % value
+ elif type == "branches":
+ tag = "/Branch: %s" % value
+ self.result = "Development/Revision: %s%s" \
+ % (revision, tag)
- self.result = "%s%s" % (version_id, version_tag)
- return self.result
-
ZopeVersionUtility = ZopeVersion()
More information about the Zope3-Checkins
mailing list