Changeset 46 in tailor


Ignore:
Timestamp:
07/05/04 16:02:13 (9 years ago)
Author:
lele@…
Hash name:
20040705140213-97f81-a71dbf81825ae1ceec4042065e6d152d80c82bbf
Message:

Correct the initialization of a new working directory

Location:
vcpx
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • vcpx/cvs.py

    r44 r46  
    285285         
    286286        c = CvsCommit(working_dir=root) 
     287 
     288        if entries: 
     289            entries = ' '.join(entries) 
     290        else: 
     291            entries = '.' 
     292             
    287293        c(entries=entries, logfile=log.name) 
    288294        log.close() 
  • vcpx/target.py

    r44 r46  
    1717HOST = socket.getfqdn() 
    1818AUTHOR = "tailor" 
     19 
     20class TargetInitializationFailure(Exception): 
     21    pass 
    1922 
    2023class SyncronizableTargetWorkingDir(object): 
     
    9598        raise "%s should override this method" % self.__class__ 
    9699 
    97     def initializeNewWorkingDir(self, root, repository, revision): 
     100    def initializeNewWorkingDir(self, root, repository, module, revision): 
    98101        """ 
    99         Initialize a new working directory, just extracted under 
     102        Initialize a new working directory, just extracted from 
    100103        some other VC system, importing everything's there. 
    101104        """ 
     
    104107 
    105108        now = datetime.now() 
    106         self._initializeWorkingDir(root) 
     109        self._initializeWorkingDir(root, module) 
    107110        self._commit(root, now, '%s@%s' % (AUTHOR, HOST), 
    108                      'Tailorization of %s@%s' % (repository, revision)) 
     111                     'Tailorization of %s' % module, 
     112                     'Upstream sources from %s at revision %s' % (repository, 
     113                                                                  revision), 
     114                     entries=[module]) 
    109115 
    110     def _initializeWorkingDir(self, root, addentry=None): 
     116    def _initializeWorkingDir(self, root, module, addentry=None): 
    111117        """ 
    112         Assuming the `root` directory is a working copy extracted 
    113         from some VC repository, add it and all its content to the 
    114         target repository. 
     118        Assuming the `root` directory contains a working copy `module` 
     119        extracted from some VC repository, add it and all its content 
     120        to the target repository. 
    115121 
    116122        This implementation first runs the given `addentry` 
     
    126132        assert addentry, "Subclass should have specified something as addentry" 
    127133         
    128         from os.path import split 
     134        from os.path import split, join 
    129135        from os import walk 
    130136 
    131         basedir,wdir = split(root) 
    132         c = addentry(working_dir=basedir) 
    133         c(entry=repr(wdir)) 
     137        c = addentry(working_dir=root) 
     138        c(entry=repr(module)) 
    134139 
    135         for dir, subdirs, files in walk(root): 
     140        for dir, subdirs, files in walk(join(root, module)): 
    136141            for excd in ['.svn', '_darcs', 'CVS']: 
    137142                if excd in subdirs: 
  • vcpx/darcs.py

    r44 r46  
    2222 
    2323class DarcsRecord(SystemCommand): 
    24     COMMAND = "darcs record --all --look-for-adds --pipe" 
     24    COMMAND = "darcs record --all --look-for-adds --pipe %(entries)s" 
    2525 
    2626    def __call__(self, output=None, dry_run=False, **kwargs): 
     
    210210 
    211211        c = DarcsRecord(working_dir=root) 
     212 
     213        if entries: 
     214            entries = ' '.join(entries) 
     215        else: 
     216            entries = '.' 
     217             
    212218        c(output=True, date=date, patchname=remark, 
    213           logmessage=changelog, author=author) 
     219          logmessage=changelog, author=author, entries=entries) 
    214220         
    215221    def _removeEntry(self, root, entry): 
     
    228234        c = DarcsMv(working_dir=root) 
    229235        c(old=oldentry, new=newentry) 
    230  
    231     def initializeNewWorkingDir(self, root, repository, revision): 
    232         """ 
    233         Initialize the new repository and create a tag. 
    234         """ 
    235          
    236         SyncronizableTargetWorkingDir.initializeNewWorkingDir(self, 
    237                                                               root, 
    238                                                               repository, 
    239                                                               revision) 
    240         #self._createTag(root, 'Upstream revision %s' % revision) 
    241236 
    242237    def _createTag(self, root, tagname): 
     
    270265            return tagname 
    271266 
    272     def _initializeWorkingDir(self, root): 
     267    def _initializeWorkingDir(self, root, module): 
    273268        """ 
    274269        Execute `darcs initialize`. 
  • vcpx/svn.py

    r44 r46  
    1414from shwrap import SystemCommand 
    1515from source import UpdatableSourceWorkingDir 
    16 from target import SyncronizableTargetWorkingDir 
     16from target import SyncronizableTargetWorkingDir, TargetInitializationFailure 
    1717 
    1818 
     
    8181 
    8282class SvnCommit(SystemCommand): 
    83     COMMAND = "svn commit --file %(logfile)s %(entries)s" 
     83    COMMAND = "svn commit --quiet --file %(logfile)s %(entries)s" 
    8484 
    8585    def __call__(self, output=None, dry_run=False, **kwargs): 
     
    282282        c(old=oldentry, new=newentry) 
    283283 
    284     def _initializeWorkingDir(self, root, addentry=None): 
     284    def _initializeWorkingDir(self, root, module, addentry=None): 
    285285        """ 
    286286        Add the given directory to an already existing svn working tree. 
    287287        """ 
    288          
    289         SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, SvnAdd) 
     288 
     289        from os.path import exists, join 
     290 
     291        if not exists(join(root, '.svn')): 
     292            raise TargetInitializationFailure("'%s' should already be under SVN" % root) 
     293 
     294        SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, module, 
     295                                                            SvnAdd) 
  • vcpx/dualwd.py

    r44 r46  
    5252    ## SyncronizableTargetWorkingDir 
    5353     
    54     def initializeNewWorkingDir(self, root, repository, revision): 
    55         self.target.initializeNewWorkingDir(root, repository, revision) 
     54    def initializeNewWorkingDir(self, root, repository, module, revision): 
     55        self.target.initializeNewWorkingDir(root, repository, module, revision) 
  • vcpx/tailor.py

    r45 r46  
    101101                                              module, revision) 
    102102        self.logger.info("initializing %s shadow" % target_kind) 
    103         dwd.initializeNewWorkingDir(self.root, repository, actual) 
     103        dwd.initializeNewWorkingDir(self.root, repository, module, actual) 
    104104 
    105105        self.source_kind = source_kind 
Note: See TracChangeset for help on using the changeset viewer.