Changeset 19 in tailor


Ignore:
Timestamp:
06/22/04 00:02:48 (9 years ago)
Author:
lele@…
Hash name:
20040621220248-97f81-5455781361206ece5a9be9397f289213bfa892aa
Message:

Factored out the _initializeWorkingDirectory method

Location:
vcpx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • vcpx/cvs.py

    r18 r19  
    291291        self._addEntry(root, newentry) 
    292292 
    293     def _initializeWorkingDir(self, root): 
     293    def _initializeWorkingDir(self, root, addentry=None): 
    294294        """ 
    295295        Add the given directory to an already existing CVS working tree. 
    296296        """ 
    297          
    298         from os.path import split, walk 
    299  
    300         basedir,wdir = split(root) 
    301         c = CvsAdd(working_dir=basedir) 
    302         c(entry=wdir) 
    303  
    304         for dir, subdirs, files in walk(root): 
    305             if '.svn' in subdirs: 
    306                 subdirs.remove('.svn') 
    307             if '_darcs' in subdirs: 
    308                 subdirs.remove('_darcs') 
    309             c = CvsAdd(working_dir=dir) 
    310             for d in subdirs+files: 
    311                 c(entry=d) 
     297 
     298        SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, CvsAdd) 
  • vcpx/target.py

    r16 r19  
    8787                     'Tailorization of %s@%s' % (repository, revision)) 
    8888 
    89     def _initializeWorkingDir(self, root): 
     89    def _initializeWorkingDir(self, root, addentry=None): 
    9090        """ 
    9191        Assuming the `root` directory is a new working copy extracted 
     
    9393        target repository. 
    9494        """ 
     95 
     96        assert addentry, "Subclass should have specified something as addentry" 
    9597         
    96         raise "%s should override this method" % self.__class__ 
     98        from os.path import split, walk 
     99 
     100        basedir,wdir = split(root) 
     101        c = addentry(working_dir=basedir) 
     102        c(entry=wdir) 
     103 
     104        for dir, subdirs, files in walk(root): 
     105            for excd in ['.svn', '_darcs', 'CVS']: 
     106                if excd in subdirs: 
     107                    subdirs.remove(excd) 
     108 
     109            c = addentry(working_dir=dir) 
     110            for d in subdirs+files: 
     111                c(entry=d) 
     112 
  • vcpx/darcs.py

    r18 r19  
    144144        self._createTag(root, 'Upstream revision %s' % revision) 
    145145 
    146     def _initializeWorkingDir(self, root): 
    147         """ 
    148         Execute `darcs initialize`. 
    149         """ 
    150          
    151         c = DarcsInitialize(working_dir=root) 
    152         c(output=True) 
    153  
    154146    def _createTag(self, root, tagname): 
    155147        """ 
     
    181173             
    182174            return tagname 
     175 
     176    def _initializeWorkingDir(self, root): 
     177        """ 
     178        Execute `darcs initialize`. 
     179        """ 
     180         
     181        c = DarcsInitialize(working_dir=root) 
     182        c(output=True) 
     183 
  • vcpx/svn.py

    r18 r19  
    253253        c(old=oldentry, new=newentry) 
    254254 
    255     def _initializeWorkingDir(self, root): 
     255    def _initializeWorkingDir(self, root, addentry=None): 
    256256        """ 
    257257        Add the given directory to an already existing svn working tree. 
    258258        """ 
    259259         
    260         from os.path import split, walk 
    261  
    262         basedir,wdir = split(root) 
    263         c = SvnAdd(working_dir=basedir) 
    264         c(entry=wdir) 
    265  
    266         for dir, subdirs, files in walk(root): 
    267             if 'CVS' in subdirs: 
    268                 subdirs.remove('CVS') 
    269             if '_darcs' in subdirs: 
    270                 subdirs.remove('_darcs') 
    271             c = SvnAdd(working_dir=dir) 
    272             for d in subdirs+files: 
    273                 c(entry=d) 
    274  
     260        SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, SvnAdd) 
Note: See TracChangeset for help on using the changeset viewer.