Changeset 293 in tailor


Ignore:
Timestamp:
05/10/05 11:06:09 (8 years ago)
Author:
lele@…
Hash name:
20050510090609-97f81-7c4bb48604aa220e686c2c13877e3b3d1dbbfa4b
Message:

Implemented targets _addSubtree() and make _initializeWorkingDir use that

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/target.py

    r291 r293  
    226226        raise "%s should override this method" % self.__class__ 
    227227 
     228    def _addSubtree(self, root, subdir): 
     229        """ 
     230        Add a whole subtree. 
     231 
     232        This implementation crawl down the whole subtree, adding 
     233        entries (subdirs, skipping the usual VC-specific control 
     234        directories such as ``.svn``, ``_darcs`` or ``CVS``, and 
     235        files). 
     236 
     237        Subclasses may use a better way, if the backend implements 
     238        a recursive add that skips the various metadata directories. 
     239        """ 
     240         
     241        from os.path import split, join 
     242        from os import walk 
     243 
     244        if subdir<>'.': 
     245            self._addPathnames(root, [subdir]) 
     246 
     247        for dir, subdirs, files in walk(join(root, subdir)): 
     248            for excd in ['.svn', '_darcs', 'CVS', '.cdv', 'MT']: 
     249                if excd in subdirs: 
     250                    subdirs.remove(excd) 
     251 
     252            # Uhm, is this really desiderable? 
     253            for excf in ['tailor.info', 'tailor.log']: 
     254                if excf in files: 
     255                    files.remove(excf) 
     256 
     257            if subdirs or files: 
     258                self._addPathnames(dir, subdirs + files) 
     259 
    228260    def _commit(self, root, date, author, remark, 
    229261                changelog=None, entries=None): 
     
    289321        """ 
    290322 
    291         assert addentry, "Subclass should have specified something as addentry" 
    292          
    293         from os.path import split, join 
    294         from os import walk 
    295  
    296         if subdir<>'.': 
    297             c = addentry(working_dir=root) 
    298             c(entry=shrepr(subdir)) 
    299  
    300         for dir, subdirs, files in walk(join(root, subdir)): 
    301             for excd in ['.svn', '_darcs', 'CVS', '.cdv']: 
    302                 if excd in subdirs: 
    303                     subdirs.remove(excd) 
    304  
    305             # Uhm, is this really desiderable? 
    306             for excf in ['tailor.info', 'tailor.log']: 
    307                 if excf in files: 
    308                     files.remove(excf) 
    309  
    310             if subdirs or files: 
    311                 c = addentry(working_dir=dir) 
    312                 c(entry=' '.join([shrepr(e) for e in subdirs+files])) 
    313  
     323        self._addSubtree(root, subdir) 
Note: See TracChangeset for help on using the changeset viewer.