Changeset 431 in tailor


Ignore:
Timestamp:
07/26/05 02:16:25 (8 years ago)
Author:
lele@…
Hash name:
20050726001625-97f81-b51941608932253b428c9298c142c1b69f363a63
Message:

Better handling of initial revision, expecially for darcs
Now tailor accepts --revision=INITIAL also for darcs: when specifying
INITIAL as revision, tailor uses the author, date and changelog of the
first changeset for the bootstrap.

Location:
vcpx
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • vcpx/target.py

    r426 r431  
    317317 
    318318    def initializeNewWorkingDir(self, root, repository, module, subdir, 
    319                                 changeset): 
     319                                changeset, initial): 
    320320        """ 
    321321        Initialize a new working directory, just extracted from 
     
    324324 
    325325        self._initializeWorkingDir(root, repository, module, subdir) 
    326         patchname = BOOTSTRAP_PATCHNAME % module 
    327326        revision = changeset.revision 
    328         changelog = BOOTSTRAP_CHANGELOG % locals() 
    329         self._commit(root, changeset.date, '%s@%s' % (AUTHOR, HOST), patchname, 
    330                      changelog, entries=[subdir]) 
     327        if initial: 
     328            author = changeset.author 
     329            remark = changeset.log 
     330            log = None 
     331        else: 
     332            author = "%s@%s" % (AUTHOR, HOST) 
     333            remark = BOOTSTRAP_PATCHNAME % module 
     334            log = BOOTSTRAP_CHANGELOG % locals() 
     335        self._commit(root, changeset.date, author, remark, log, 
     336                     entries=[subdir]) 
    331337 
    332338    def _initializeWorkingDir(self, root, repository, module, subdir): 
  • vcpx/darcs.py

    r428 r431  
    197197        """ 
    198198 
     199        from re import escape 
     200         
    199201        if changeset.revision.startswith('tagged '): 
    200202            selector = '--tags' 
     
    202204        else: 
    203205            selector = '--patches' 
    204             revtag = changeset.revision 
     206            revtag = escape(changeset.revision) 
    205207             
    206208        cmd = [DARCS_CMD, "pull", "--all", selector, revtag] 
     
    229231        from os.path import join, exists 
    230232        from os import mkdir 
    231  
     233        from re import escape 
     234         
     235        if revision == 'INITIAL': 
     236            initial = True 
     237            cmd = [DARCS_CMD, "changes", "--xml-output", "--repo", repository] 
     238            changes = ExternalCommand(command=cmd) 
     239            output = changes.execute(stdout=PIPE, stderr=STDOUT) 
     240 
     241            if changes.exit_status: 
     242                raise ChangesetApplicationFailure( 
     243                    "%s returned status %d saying \"%s\"" % 
     244                    (str(changes), changes.exit_status, output.read())) 
     245 
     246            csets = changesets_from_darcschanges(output) 
     247            revision = escape(csets[0].revision) 
     248        else: 
     249            initial = False 
     250 
     251        wdir = join(basedir, subdir) 
    232252        if subdir == '.': 
    233253            # This is currently *very* slow, compared to the darcs get 
    234254            # below! 
    235             wdir = basedir 
    236255            if not exists(join(wdir, '_darcs')): 
    237256                if not exists(wdir): 
     
    249268                cmd = [DARCS_CMD, "pull", "--all", "--verbose"] 
    250269                if revision and revision<>'HEAD': 
    251                     cmd.extend(["--tag", revision]) 
     270                    cmd.extend([initial and "--patches" or "--tags", revision]) 
    252271                dpull = ExternalCommand(cwd=wdir, command=cmd) 
    253272                output = dpull.execute(repository, stdout=PIPE, stderr=STDOUT) 
     
    259278        else: 
    260279            # Use much faster 'darcs get' 
    261              
    262             wdir = join(basedir, subdir) 
    263280            cmd = [DARCS_CMD, "get", "--partial", "--verbose"] 
    264281            if revision and revision<>'HEAD': 
    265                 cmd.extend(["--tag", revision]) 
     282                cmd.extend([initial and "--to-patch" or "--tag", revision]) 
    266283            dget = ExternalCommand(cwd=basedir, command=cmd) 
    267284            output = dget.execute(repository, subdir, 
  • vcpx/tailor.py

    r429 r431  
    336336 
    337337        try: 
    338             dwd.initializeNewWorkingDir(self.root, repository, module, subdir, actual) 
     338            dwd.initializeNewWorkingDir(self.root, repository, module, subdir, 
     339                                        actual, revision=='INITIAL') 
    339340        except: 
    340341            self.logger.exception('Working copy initialization failed!') 
     
    525526                     "name, a timestamp or both separated by a space, and " 
    526527                     "timestamp may be 'INITIAL' to denote the beginning of " 
    527                      "time for the given branch. " 
     528                     "time for the given branch. Under Darcs, INITIAL is a " 
     529                     "shortcut for the name of the first patch in the upstream " 
     530                     "repository, otherwise it is interpreted as the name of " 
     531                     "a tag. " 
    528532                     "'HEAD', the default, means the latest version in all " 
    529533                     "backends.", 
  • vcpx/cdv.py

    r430 r431  
    6464 
    6565    def initializeNewWorkingDir(self, root, repository, module, subdir, 
    66                                 changeset): 
     66                                changeset, initial): 
    6767        """ 
    6868        Initialize a new working directory, just extracted from 
     
    7575        self._initializeWorkingDir(root, repository, module, subdir) 
    7676        revision = changeset.revision 
    77         self._commit(root, changeset.date, '%s@%s' % (AUTHOR, HOST), 
    78                      BOOTSTRAP_PATCHNAME % module, 
    79                      BOOTSTRAP_CHANGELOG % locals(), 
     77        if initial: 
     78            author = changeset.author 
     79            remark = changeset.log 
     80            log = None 
     81        else: 
     82            author = "%s@%s" % (AUTHOR, HOST) 
     83            remark = BOOTSTRAP_PATCHNAME % module 
     84            log = BOOTSTRAP_CHANGELOG % locals() 
     85        self._commit(root, changeset.date, author, remark, log, 
    8086                     entries=[subdir, '%s/...' % subdir]) 
    8187 
  • vcpx/bzr.py

    r430 r431  
    6262 
    6363    def initializeNewWorkingDir(self, root, repository, module, subdir, 
    64                                 changeset): 
     64                                changeset, initial): 
    6565        """ 
    6666        Initialize a new working directory, just extracted from 
     
    7070        from target import AUTHOR, HOST, BOOTSTRAP_PATCHNAME, \ 
    7171             BOOTSTRAP_CHANGELOG 
    72          
     72 
    7373        self._initializeWorkingDir(root, repository, module, subdir) 
    7474        revision = changeset.revision 
    75         self._commit(root, changeset.date, AUTHOR, 
    76                      BOOTSTRAP_PATCHNAME % module, 
    77                      BOOTSTRAP_CHANGELOG % locals(), 
     75        if initial: 
     76            author = changeset.author 
     77            remark = changeset.log 
     78            log = None 
     79        else: 
     80            author = "%s@%s" % (AUTHOR, HOST) 
     81            remark = BOOTSTRAP_PATCHNAME % module 
     82            log = BOOTSTRAP_CHANGELOG % locals() 
     83        self._commit(root, changeset.date, author, remark, log, 
    7884                     entries=[subdir, '%s/...' % subdir]) 
    7985 
  • vcpx/session.py

    r426 r431  
    516516                                        self.source_module, 
    517517                                        self.sub_directory, 
    518                                         actual) 
     518                                        actual, revision=='INITIAL') 
    519519        except: 
    520520            self.__err('Working copy initialization failed', True) 
Note: See TracChangeset for help on using the changeset viewer.