Changeset 455 in tailor


Ignore:
Timestamp:
07/30/05 03:16:41 (8 years ago)
Author:
lele@…
Hash name:
20050730011641-97f81-ce33e46e7882dbc5dbe0af7a27576aa7e7758324
Message:

Target repository creation for Subversion
Using the new --target-repository and --target-module at bootstrap time
it's now easier to use a target SVN repository. If it's on the local
machine (it starts with  file:///) then when it does not exist tailor
creates it of kind fsfs.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vcpx/svn.py

    r454 r455  
    1212__docformat__ = 'reStructuredText' 
    1313 
    14 from shwrap import ExternalCommand, PIPE, ReopenableNamedTemporaryFile 
     14from shwrap import ExternalCommand, PIPE, STDOUT, ReopenableNamedTemporaryFile 
    1515from source import UpdatableSourceWorkingDir, \ 
    1616     ChangesetApplicationFailure, GetUpstreamChangesetsFailure 
     
    1818 
    1919SVN_CMD = "svn" 
     20SVNADMIN_CMD = "svnadmin" 
    2021 
    2122def changesets_from_svnlog(log, url, repository, module): 
     
    389390            self._addPathnames(root, [newname]) 
    390391 
     392    def __createRepository(self, target_repository, target_module): 
     393        """ 
     394        Create a local repository. 
     395        """ 
     396 
     397        assert target_repository.startswith('file:///') 
     398 
     399        cmd = [SVNADMIN_CMD, "create", "--fs-type", "fsfs"] 
     400        svnadmin = ExternalCommand(command=cmd) 
     401        svnadmin.execute(target_repository[7:]) 
     402 
     403        if svnadmin.exit_status: 
     404            raise TargetInitializationFailure("Was not able to create a 'fsfs' " 
     405                                              "svn repository at %r" % 
     406                                              target_repository) 
     407 
     408        if target_module and target_module <> '/': 
     409            cmd = [SVN_CMD, "mkdir", "-m", 
     410                   "This directory will host the upstream sources"] 
     411            svnmkdir = ExternalCommand(command=cmd) 
     412            svnmkdir.execute(target_repository + target_module) 
     413            if svnmkdir.exit_status: 
     414                raise TargetInitializationFailure("Was not able to create the " 
     415                                                  "module %r, maybe more than " 
     416                                                  "one level directory?" % 
     417                                                  target_module) 
     418 
     419    def _prepareTargetRepository(self, root, target_repository, target_module): 
     420        """ 
     421        Check for target repository existence, eventually create it. 
     422        """ 
     423 
     424        cmd = [SVN_CMD, "info"] 
     425        svninfo = ExternalCommand(command=cmd) 
     426        svninfo.execute(target_repository, stdout=PIPE, stderr=STDOUT) 
     427 
     428        if svninfo.exit_status: 
     429            if target_repository.startswith('file:///'): 
     430                self.__createRepository(target_repository, target_module) 
     431            else: 
     432                raise TargetInitializationFailure("%r does not exist and " 
     433                                                  "cannot be created since " 
     434                                                  "it's not a local (file:///) " 
     435                                                  "repository" % 
     436                                                  target_repository) 
     437 
     438    def _prepareWorkingDirectory(self, root, target_repository, target_module): 
     439        """ 
     440        Checkout a working copy of the target SVN repository. 
     441        """ 
     442 
     443        cmd = [SVN_CMD, "co", "--quiet"] 
     444        svnco = ExternalCommand(command=cmd) 
     445        svnco.execute(target_repository + target_module, root) 
     446 
    391447    def _initializeWorkingDir(self, root, source_repository, source_module, 
    392448                              subdir): 
  • README

    r429 r455  
    121121__ http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1 
    122122__ http://svn.haxx.se/users/archive-2004-05/0245.shtml 
    123     
    124     
     123 
    1251243. Showing each command bootstrap a new DARCS repos in 
    126125   "~/darcs/cmftopic" under which the upstream module will be 
     
    156155                --module something new-darcs-repository 
    157156 
    158  
     1578. Bootstrap a new SVN repository with tailor's master one. This 
     158   demonstrate the new --target-repository feature:: 
     159 
     160    $ tailor -D -v -b -R http://nautilus.homeip.net/~lele/projects/tailor \ 
     161            -s darcs -t svn --target-repository file:///tmp/svnrepo \ 
     162            --target-module / /tmp/wc 
     163    $ svn info file:///tmp/svnrepo [Status 1] 
     164    $ svnadmin create --fs-type fsfs /tmp/svnrepo [Ok] 
     165    $ svn co --quiet file:///tmp/svnrepo/ /tmp/wc [Ok] 
     166    /tmp/wc $ darcs get --partial --verbose http://.../tailor tailor [Ok] 
     167    /tmp/wc/tailor $ darcs changes --last 1 --xml-output [Ok] 
     168    /tmp/wc $ svn add --quiet --no-auto-props --non-recursive tailor [Ok] 
     169    ... 
     170     
    159171Resolving conflicts 
    160172=================== 
Note: See TracChangeset for help on using the changeset viewer.