Changeset 233 in tailor


Ignore:
Timestamp:
03/22/05 18:31:53 (8 years ago)
Author:
lele@…
Hash name:
20050322173153-97f81-ec7b53123e3a9635cdea9d363c2920fd8db31d20
Message:

Quote any filename fed to underlying shell process

Location:
vcpx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • vcpx/cvsps.py

    r201 r233  
    1414__docformat__ = 'reStructuredText' 
    1515 
    16 from shwrap import SystemCommand 
     16from shwrap import SystemCommand, shrepr 
    1717from source import UpdatableSourceWorkingDir, ChangesetApplicationFailure, \ 
    1818     InvocationError 
     
    299299              module=module, 
    300300              revision=revision, 
    301               workingdir=subdir) 
     301              workingdir=shrepr(subdir)) 
    302302            if c.exit_status: 
    303303                raise TargetInitializationFailure( 
     
    424424 
    425425        c = CvsAdd(working_dir=root) 
    426         c(entry=entry) 
     426        c(entry=shrepr(entry)) 
    427427 
    428428    def __forceTagOnEachEntry(self, root): 
     
    477477 
    478478        if entries: 
    479             entries = ' '.join(entries) 
     479            entries = ' '.join([shrepr(e) for e in entries]) 
    480480        else: 
    481481            entries = '.' 
     
    490490 
    491491        c = CvsRemove(working_dir=root) 
    492         c(entry=entry) 
     492        c(entry=shrepr(entry)) 
    493493 
    494494    def _renameEntry(self, root, oldentry, newentry): 
  • vcpx/target.py

    r230 r233  
    1414 
    1515import socket 
     16from shwrap import shrepr 
    1617 
    1718HOST = socket.getfqdn() 
     
    269270        if subdir<>'.': 
    270271            c = addentry(working_dir=root) 
    271             c(entry=repr(subdir)) 
     272            c(entry=shrepr(subdir)) 
    272273 
    273274        for dir, subdirs, files in walk(join(root, subdir)): 
     
    283284            if subdirs or files: 
    284285                c = addentry(working_dir=dir) 
    285                 c(entry=' '.join([repr(e) for e in subdirs+files])) 
    286  
     286                c(entry=' '.join([shrepr(e) for e in subdirs+files])) 
     287 
  • vcpx/darcs.py

    r224 r233  
    1212__docformat__ = 'reStructuredText' 
    1313 
    14 from shwrap import SystemCommand 
     14from shwrap import SystemCommand, shrepr 
    1515from source import UpdatableSourceWorkingDir, ChangesetApplicationFailure, \ 
    1616     GetUpstreamChangesetsFailure 
     
    193193        c = SystemCommand(working_dir=root, 
    194194                          command="darcs pull --all --patches=%(patch)s") 
    195         output = c(output=True, patch=repr(changeset.revision)) 
     195        output = c(output=True, patch=shrepr(changeset.revision)) 
    196196        if c.exit_status: 
    197197            raise ChangesetApplicationFailure("'darcs pull' returned status %d saying \"%s\"" % (c.exit_status, output.getvalue().strip())) 
     
    229229             
    230230            output = dpull(output=True, repository=repository, 
    231                            tag=(revision<>'HEAD' and '--tag=%s'%repr(revision) 
     231                           tag=(revision<>'HEAD' and 
     232                                '--tag=%s' % shrepr(revision) 
    232233                                or '')) 
    233234            if dpull.exit_status: 
     
    257258                          command="darcs add --case-ok --recursive" 
    258259                                  " --quiet %(entry)s") 
    259         c(entry=' '.join([e.name for e in entries])) 
     260        c(entry=' '.join([shrepr(e.name) for e in entries])) 
    260261         
    261262    def _commit(self,root, date, author, remark, changelog=None, entries=None): 
     
    267268 
    268269        if entries: 
    269             entries = ' '.join(entries) 
     270            entries = ' '.join([shrepr(e) for e in entries]) 
    270271        else: 
    271272            entries = '.' 
     
    298299        c = SystemCommand(working_dir=root, 
    299300                          command="darcs mv %(old)s %(new)s") 
    300         c(old=oldentry, new=newentry) 
     301        c(old=shrepr(oldentry), new=shrepr(newentry)) 
    301302 
    302303    def _initializeWorkingDir(self, root, repository, module, subdir, addentry=None): 
     
    325326                          command="darcs add --case-ok --recursive" 
    326327                          " --quiet %(entry)s") 
    327         c(entry=subdir) 
     328        c(entry=shrepr(subdir)) 
  • vcpx/svn.py

    r215 r233  
    1212__docformat__ = 'reStructuredText' 
    1313 
    14 from shwrap import SystemCommand 
     14from shwrap import SystemCommand, shrepr 
    1515from source import UpdatableSourceWorkingDir, \ 
    1616     ChangesetApplicationFailure, GetUpstreamChangesetsFailure 
     
    310310            svnco = SvnCheckout(working_dir=basedir) 
    311311            svnco(output=True, repository=repository, module=module, 
    312                   wc=subdir, revision=revision) 
     312                  wc=shrepr(subdir), revision=revision) 
    313313            if svnco.exit_status: 
    314314                raise TargetInitializationFailure( 
     
    339339 
    340340        c = SvnAdd(working_dir=root) 
    341         c(entry=' '.join([e.name for e in entries])) 
     341        c(entry=' '.join([shrepr(e.name) for e in entries])) 
    342342 
    343343    def _commit(self,root, date, author, remark, changelog=None, entries=None): 
     
    354354             
    355355        if entries: 
    356             entries = ' '.join(entries) 
     356            entries = ' '.join([shrepr(e) for e in entries]) 
    357357        else: 
    358358            entries = '.' 
     
    366366 
    367367        c = SvnRemove(working_dir=root) 
    368         c(entry=' '.join([e.name for e in entries])) 
     368        c(entry=' '.join([shrepr(e.name) for e in entries])) 
    369369 
    370370    def _renameEntry(self, root, oldentry, newentry): 
     
    374374 
    375375        c = SvnMv(working_dir=root) 
    376         c(old=oldentry, new=newentry) 
     376        c(old=shrepr(oldentry), new=repr(newentry)) 
    377377 
    378378    def _initializeWorkingDir(self, root, repository, module, subdir, addentry=None): 
  • vcpx/shwrap.py

    r65 r233  
    99from StringIO import StringIO 
    1010from sys import stderr 
     11 
     12def shrepr(str): 
     13    str = str.replace("'", "\\'") 
     14    return "'" + str + "'" 
    1115 
    1216class VerboseStringIO(StringIO): 
Note: See TracChangeset for help on using the changeset viewer.