Changeset 446 in tailor


Ignore:
Timestamp:
07/30/05 01:57:22 (8 years ago)
Author:
lele@…
Hash name:
20050729235722-97f81-533acd388a4445e9bc5c543a864adc16c8823acb
Message:

Introduced --source-repository and --source-module as aliases for -R and -m
This is to allow --target-repository and --target-module options, needed
to create the target working copy at bootstrap time.

Location:
vcpx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vcpx/tailor.py

    r442 r446  
    8888            for root in args: 
    8989                if self.options.bootstrap: 
    90                     if not (fromconfig or self.options.repository): 
     90                    if not (fromconfig or self.options.source_repository): 
    9191                        raise InvocationError('Need a repository to bootstrap ' 
    9292                                              '%r' % root, '--bootstrap') 
     
    103103                        self.options.source_kind = info['source_kind'] 
    104104                        self.options.target_kind = info['target_kind'] 
    105                         self.options.repository = info['upstream_repos'] 
    106                         self.options.module = info['module'] 
     105                        self.options.source_repository = info['upstream_repos'] 
     106                        self.options.source_module = info['module'] 
    107107                        self.options.subdir = info.get('subdir', 
    108108                                                       split(info['module'])[1]) 
     
    111111                    tailored.bootstrap(self.options.source_kind, 
    112112                                       self.options.target_kind, 
    113                                        self.options.repository, 
    114                                        self.options.module, 
     113                                       self.options.source_repository, 
     114                                       self.options.source_module, 
    115115                                       self.options.revision, 
    116116                                       self.options.subdir) 
     
    152152            project.source_kind = info['source_kind'] 
    153153            project.target_kind = info['target_kind'] 
    154             project.module = info['module'] 
    155             project.subdir = info.get('subdir', split(project.module)[1]) 
     154            project.upstream_module = info['module'] 
     155            project.subdir = info.get('subdir', 
     156                                      split(project.upstream_module)[1]) 
    156157            project.upstream_repos = info['upstream_repos'] 
    157158            project.upstream_revision = info['upstream_revision'] 
     
    165166            'source_kind': project.source_kind, 
    166167            'target_kind': project.target_kind, 
    167             'module': project.module, 
     168            'module': project.upstream_module, 
    168169            'subdir': project.subdir, 
    169170            'upstream_repos': project.upstream_repos, 
     
    211212        print >>f, self.source_kind 
    212213        print >>f, self.target_kind 
    213         print >>f, self.module 
     214        print >>f, self.upstream_module 
    214215        print >>f, self.upstream_repos 
    215216        print >>f, self.upstream_revision 
     
    234235        self.source_kind = f.readline()[:-1] 
    235236        self.target_kind = f.readline()[:-1] 
    236         self.module = f.readline()[:-1] 
     237        self.upstream_module = f.readline()[:-1] 
    237238        self.upstream_repos = f.readline()[:-1] 
    238239        self.upstream_revision = f.readline()[:-1] 
     
    241242            self.subdir = subdir[:-1] 
    242243        else: 
    243             self.subdir = split(self.module)[1] 
     244            self.subdir = split(self.upstream_module)[1] 
    244245        f.close() 
    245246 
     
    256257        # Fix old configs 
    257258 
    258         if self.source_kind == 'svn' and not '/' in self.module: 
     259        if self.source_kind == 'svn' and not '/' in self.upstream_module: 
    259260            self.logger.warning('OLD config values for SVN') 
    260261            print "The project at '%s' contains old values for" % self.root 
    261262            print "the upstream repository (%s)" % self.upstream_repos 
    262             print "and module (%s)." % self.module 
     263            print "and module (%s)." % self.upstream_module 
    263264            print "Please correct them, specifying the exact URL of the" 
    264265            print "root of the SVN repository and then the prefix path up" 
     
    282283            try: 
    283284                self.repository = raw_input('Repository: ') 
    284                 self.module = raw_input('Module/prefix: ') 
     285                self.upstream_module = raw_input('Module/prefix: ') 
    285286            except KeyboardInterrupt: 
    286287                self.logger.warning("Leaving old config values, stopped by user") 
     
    288289 
    289290    def bootstrap(self, source_kind, target_kind, 
    290                   repository, module, revision, subdir): 
     291                  source_repository, source_module, revision, subdir): 
    291292        """ 
    292293        Bootstrap a new tailorized module. 
     
    301302 
    302303        if source_kind == 'svn': 
    303             if not (module and module.startswith('/')): 
     304            if not (source_module and source_module.startswith('/')): 
    304305                raise InvocationError('With SVN the module argument is ' 
    305306                                      'mandatory and must start with a "/"') 
    306307 
    307         if repository.endswith('/'): 
    308             repository = repository[:-1] 
    309  
    310         if module and module.endswith('/'): 
    311             module = module[:-1] 
     308        if source_repository.endswith('/'): 
     309            source_repository = source_repository[:-1] 
     310 
     311        if source_module and source_module.endswith('/'): 
     312            source_module = source_module[:-1] 
    312313 
    313314        if not subdir: 
    314             subdir = split(module or repository)[1] or '' 
     315            subdir = split(source_module or source_repository)[1] or '' 
    315316 
    316317        self.logger.info("Bootstrapping '%s'" % (self.root,)) 
     
    318319        dwd = DualWorkingDir(source_kind, target_kind) 
    319320        self.logger.info("getting %s revision '%s' of '%s' from '%s'" % ( 
    320             source_kind, revision, module, repository)) 
     321            source_kind, revision, source_module, source_repository)) 
    321322 
    322323        try: 
    323             actual = dwd.checkoutUpstreamRevision(self.root, repository, 
    324                                                   module, revision, 
     324            actual = dwd.checkoutUpstreamRevision(self.root, source_repository, 
     325                                                  source_module, revision, 
    325326                                                  subdir=subdir, 
    326327                                                  logger=self.logger) 
     
    332333        # in the directory named as the last component of the module's name 
    333334 
    334         if not module: 
    335             module = split(repository)[1] 
     335        if not source_module: 
     336            source_module = split(repository)[1] 
    336337 
    337338        try: 
    338             dwd.initializeNewWorkingDir(self.root, repository, module, subdir, 
     339            dwd.initializeNewWorkingDir(self.root, source_repository, 
     340                                        source_module, subdir, 
    339341                                        actual, revision=='INITIAL') 
    340342        except: 
     
    344346        self.source_kind = source_kind 
    345347        self.target_kind = target_kind 
    346         self.upstream_repos = repository 
    347         self.module = module 
     348        self.upstream_repos = source_repository 
     349        self.upstream_module = source_module 
    348350        self.subdir = subdir 
    349351        self.upstream_revision = actual.revision 
     
    392394 
    393395        self.logger.info("Updating '%s' from revision '%s'" % ( 
    394             self.module, self.upstream_revision)) 
     396            self.upstream_module, self.upstream_revision)) 
    395397 
    396398        if self.verbose: 
    397399            print "\nUpdating '%s' from revision '%s'" % ( 
    398                 self.module, self.upstream_revision) 
     400                self.upstream_module, self.upstream_revision) 
    399401 
    400402        try: 
     
    402404            changesets = dwd.getUpstreamChangesets(proj, 
    403405                                                   self.upstream_repos, 
    404                                                    self.module, 
     406                                                   self.upstream_module, 
    405407                                                   self.upstream_revision) 
    406408        except KeyboardInterrupt: 
     
    419421            try: 
    420422                last, conflicts = dwd.applyUpstreamChangesets( 
    421                     proj, self.module, changesets, applyable=self.applyable, 
     423                    proj, self.upstream_module, changesets, 
     424                    applyable=self.applyable, 
    422425                    applied=self.applied, logger=self.logger, 
    423426                    delayed_commit=single_commit) 
     
    511514                     "with 'darcs' as default.", 
    512515                default="darcs"), 
    513     make_option("-R", "--repository", dest="repository", metavar="REPOS", 
     516    make_option("-R", "--repository", "--source-repository", 
     517                dest="source_repository", metavar="REPOS", 
    514518                help="Specify the upstream repository, from where bootstrap " 
    515519                     "will checkout the module.  REPOS syntax depends on " 
    516520                     "the source version control kind."), 
    517     make_option("-m", "--module", dest="module", metavar="MODULE", 
     521    make_option("-m", "--module", "--source-module", dest="source_module", 
     522                metavar="MODULE", 
    518523                help="Specify the module to checkout at bootstrap time. " 
    519524                     "This has different meanings under the various upstream " 
     
    639644                        "Project %r cannot be bootstrapped twice" % proj) 
    640645 
    641                 if not options.repository: 
     646                if not options.source_repository: 
    642647                    raise InvocationError('Need a repository to bootstrap %r' % 
    643648                                          proj) 
     
    655660            if options.bootstrap: 
    656661                tailored.bootstrap(options.source_kind, options.target_kind, 
    657                                    options.repository, 
    658                                    options.module, 
     662                                   options.source_repository, 
     663                                   options.source_module, 
    659664                                   options.revision, 
    660665                                   options.subdir) 
  • vcpx/session.py

    r441 r446  
    5353        self.args = args 
    5454 
    55         self.source_repository = options.repository 
     55        self.source_repository = options.source_repository 
    5656        self.source_kind = options.source_kind 
    57         self.source_module = options.module 
     57        self.source_module = options.source_module 
    5858        self.target_repository = None 
    5959        self.target_kind = options.target_kind 
Note: See TracChangeset for help on using the changeset viewer.