logo       


svn commit: r1654 - trunk/lib: . vclib vclib/bincvs vclib/svn vclib/svn_ra: msg#00013

Subject: svn commit: r1654 - trunk/lib: . vclib vclib/bincvs vclib/svn vclib/svn_ra
Author: cmpilato
Date: 2007-05-10 13:47:27-0700
New Revision: 1654

Modified:
   trunk/lib/vclib/__init__.py
   trunk/lib/vclib/bincvs/__init__.py
   trunk/lib/vclib/svn/__init__.py
   trunk/lib/vclib/svn_ra/__init__.py
   trunk/lib/viewvc.py

Log:
Ensure that vclib.Repository objects are aware of their name, path,
and type by forcing them to implement functions which query those
pieces of information.

* lib/vclib/__init__.py
  (Repository.rootname, Repository.rootpath, Repository.roottype): New.

* lib/vclib/bincvs/__init__.py
  (CVSRepository.rootname, CVSRepository.rootpath,
    CVSRepository.roottype): New.

* lib/vclib/svn/__init__.py
  (SubversionRepository.rootname, SubversionRepository.rootpath,
    SubversionRepository.roottype): New.
  
* lib/vclib/svn_ra/__init__.py
  (SubversionRepository.rootname, SubversionRepository.rootpath,
    SubversionRepository.roottype): New.

* lib/viewvc.py
  (Request.run_viewvc): Ask the Repository object for its roottype(),
    and translate the vclib value into a string.  (It would be nice to
    use the vclib value throughout the codebase, but not today.)

Modified: trunk/lib/vclib/__init__.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/vclib/__init__.py?view=diff&rev=1654&p1=trunk/lib/vclib/__init__.py&p2=trunk/lib/vclib/__init__.py&r1=1653&r2=1654
==============================================================================
--- trunk/lib/vclib/__init__.py (original)
+++ trunk/lib/vclib/__init__.py 2007-05-10 13:47:27-0700
@@ -27,11 +27,25 @@
 CONTEXT = 2
 SIDE_BY_SIDE = 3
 
+# root types returned by Repository.roottype().
+CVS = 'cvs'
+SVN = 'svn'
+
+
 # ======================================================================
 #
 class Repository:
   """Abstract class representing a repository."""
 
+  def rootname(self):
+    """Return the name of this repository."""
+
+  def roottype(self):
+    """Return the type of this repository (vclib.CVS, vclib.SVN, ...)."""
+
+  def rootpath(self):
+    """Return the location of this repository."""
+    
   def itemtype(self, path_parts, rev):
     """Return the type of the item (file or dir) at the given path and revision
 

Modified: trunk/lib/vclib/bincvs/__init__.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/vclib/bincvs/__init__.py?view=diff&rev=1654&p1=trunk/lib/vclib/bincvs/__init__.py&p2=trunk/lib/vclib/bincvs/__init__.py&r1=1653&r2=1654
==============================================================================
--- trunk/lib/vclib/bincvs/__init__.py  (original)
+++ trunk/lib/vclib/bincvs/__init__.py  2007-05-10 13:47:27-0700
@@ -34,6 +34,15 @@
     self.rootpath = rootpath
     self.utilities = utilities
 
+  def rootname(self):
+    return self.name
+
+  def rootpath(self):
+    return self.rootpath
+
+  def roottype(self):
+    return vclib.CVS
+  
   def itemtype(self, path_parts, rev):
     basepath = self._getpath(path_parts)
     if os.path.isdir(basepath):

Modified: trunk/lib/vclib/svn/__init__.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/vclib/svn/__init__.py?view=diff&rev=1654&p1=trunk/lib/vclib/svn/__init__.py&p2=trunk/lib/vclib/svn/__init__.py&r1=1653&r2=1654
==============================================================================
--- trunk/lib/vclib/svn/__init__.py     (original)
+++ trunk/lib/vclib/svn/__init__.py     2007-05-10 13:47:27-0700
@@ -547,6 +547,15 @@
     self.youngest = fs.youngest_rev(self.fs_ptr)
     self._fsroots = {}
 
+  def rootname(self):
+    return self.name
+
+  def rootpath(self):
+    return self.rootpath
+
+  def roottype(self):
+    return vclib.SVN
+
   def itemtype(self, path_parts, rev):
     rev = self._getrev(rev)
     basepath = self._getpath(path_parts)

Modified: trunk/lib/vclib/svn_ra/__init__.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/vclib/svn_ra/__init__.py?view=diff&rev=1654&p1=trunk/lib/vclib/svn_ra/__init__.py&p2=trunk/lib/vclib/svn_ra/__init__.py&r1=1653&r2=1654
==============================================================================
--- trunk/lib/vclib/svn_ra/__init__.py  (original)
+++ trunk/lib/vclib/svn_ra/__init__.py  2007-05-10 13:47:27-0700
@@ -282,6 +282,15 @@
     self.youngest = ra.svn_ra_get_latest_revnum(self.ra_session)
     self._dirent_cache = { }
 
+  def rootname(self):
+    return self.name
+
+  def rootpath(self):
+    return self.rootpath
+
+  def roottype(self):
+    return vclib.SVN
+
   def itemtype(self, path_parts, rev):
     path = self._getpath(path_parts[:-1])
     rev = self._getrev(rev)

Modified: trunk/lib/viewvc.py
Url: 
http://viewvc.tigris.org/source/browse/viewvc/trunk/lib/viewvc.py?view=diff&rev=1654&p1=trunk/lib/viewvc.py&p2=trunk/lib/viewvc.py&r1=1653&r2=1654
==============================================================================
--- trunk/lib/viewvc.py (original)
+++ trunk/lib/viewvc.py 2007-05-10 13:47:27-0700
@@ -242,7 +242,6 @@
             self.repos = vclib.bincvs.BinCVSRepository(self.rootname, 
                                                        self.rootpath,
                                                        cfg.utilities)
-          self.roottype = 'cvs'
         except vclib.ReposNotFound:
           raise debug.ViewVCException(
             'Unable to locate CVS root "%s".  Possible causes include '
@@ -266,7 +265,6 @@
           self.repos = vclib.svn.SubversionRepository(self.rootname,
                                                       self.rootpath,
                                                       cfg.utilities)
-          self.roottype = 'svn'
         except vclib.ReposNotFound:
           raise debug.ViewVCException(
             'Unable to locate Subversion root "%s".  Possible causes include '
@@ -281,6 +279,17 @@
           'correct, then please double-check your configuration.'
           % self.rootname, "404 Repository not found")
 
+    if self.repos:
+      type = self.repos.roottype()
+      if type == vclib.SVN:
+        self.roottype = 'svn'
+      elif type == vclib.CVS:
+        self.roottype = 'cvs'
+      else:
+        raise debug.ViewVCException(
+          'The root "%s" has an unknown type (%s).' % (self.rootname, type),
+          "500 Internal Server Error")
+      
     if self.rootname and cfg.options.authorizer:
       self.auth = setup_authorizer(cfg, self.username, self.rootname,
                                    self.rootpath, self.roottype)


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe