Changeset 448 in tailor


Ignore:
Timestamp:
07/30/05 02:20:10 (8 years ago)
Author:
lele@…
Hash name:
20050730002010-97f81-9b093a9d05e23d67767aa14c0ec4b8ebf302a9a8
Message:

M-x whitespace-cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/darcs.py

    r433 r448  
    44# :Autore:   Lele Gaifax <lele@nautilus.homeip.net> 
    55# :Licenza:  GNU General Public License 
    6 #  
     6# 
    77 
    88""" 
     
    3131    Return a list of ``Changeset`` instances. 
    3232    """ 
    33      
     33 
    3434    from xml.sax import parse 
    3535    from xml.sax.handler import ContentHandler 
     
    4848            else: 
    4949                self.darcsdiff = None 
    50                  
     50 
    5151        def startElement(self, name, attributes): 
    5252            if name == 'patch': 
     
    8282                                 self.current['comment'], 
    8383                                 self.current['entries']) 
    84                  
     84 
    8585                if self.darcsdiff: 
    8686                    cset.unidiff = self.darcsdiff.execute( 
    8787                        stdout=PIPE, patchname=cset.revision).read() 
    88                      
     88 
    8989                self.changesets.append(cset) 
    9090                self.current = None 
     
    115115    parse(changes, handler) 
    116116    changesets = handler.changesets 
    117      
     117 
    118118    # sort changeset by date 
    119119    changesets.sort(lambda x, y: cmp(x.date, y.date)) 
     
    121121    return changesets 
    122122 
    123      
     123 
    124124class DarcsWorkingDir(UpdatableSourceWorkingDir,SyncronizableTargetWorkingDir): 
    125125    """ 
     
    128128 
    129129    ## UpdatableSourceWorkingDir 
    130      
     130 
    131131    def getUpstreamChangesets(self, root, repository, module, sincerev=None): 
    132132        """ 
     
    137137        from time import strptime 
    138138        from changes import Changeset 
    139          
     139 
    140140        cmd = [DARCS_CMD, "pull", "--dry-run"] 
    141141        pull = ExternalCommand(cwd=root, command=cmd) 
    142142        output = pull.execute(repository, stdout=PIPE, stderr=STDOUT, TZ='UTC') 
    143          
     143 
    144144        if pull.exit_status: 
    145145            raise GetUpstreamChangesetsFailure( 
     
    191191 
    192192        return changesets 
    193      
     193 
    194194    def _applyChangeset(self, root, changeset, logger=None): 
    195195        """ 
     
    198198 
    199199        from re import escape 
    200          
     200 
    201201        if changeset.revision.startswith('tagged '): 
    202202            selector = '--tags' 
     
    205205            selector = '--patches' 
    206206            revtag = escape(changeset.revision) 
    207              
     207 
    208208        cmd = [DARCS_CMD, "pull", "--all", selector, revtag] 
    209209        pull = ExternalCommand(cwd=root, command=cmd) 
    210210        output = pull.execute(stdout=PIPE, stderr=STDOUT) 
    211          
     211 
    212212        if pull.exit_status: 
    213213            raise ChangesetApplicationFailure( 
     
    232232        from os import mkdir 
    233233        from re import escape 
    234          
     234 
    235235        if revision == 'INITIAL': 
    236236            initial = True 
     
    271271                dpull = ExternalCommand(cwd=wdir, command=cmd) 
    272272                output = dpull.execute(repository, stdout=PIPE, stderr=STDOUT) 
    273                          
     273 
    274274                if dpull.exit_status: 
    275275                    raise TargetInitializationFailure( 
     
    284284            output = dget.execute(repository, subdir, 
    285285                                  stdout=PIPE, stderr=STDOUT) 
    286              
     286 
    287287            if dget.exit_status: 
    288288                raise TargetInitializationFailure( 
     
    293293        changes = ExternalCommand(cwd=wdir, command=cmd) 
    294294        output = changes.execute(stdout=PIPE, stderr=STDOUT) 
    295          
     295 
    296296        if changes.exit_status: 
    297297            raise ChangesetApplicationFailure( 
    298298                "%s returned status %d saying \"%s\"" % 
    299299                (str(changes), changes.exit_status, output.read())) 
    300          
     300 
    301301        last = changesets_from_darcschanges(output) 
    302          
     302 
    303303        return last[0] 
    304304 
    305      
     305 
    306306    ## SyncronizableTargetWorkingDir 
    307     
     307 
    308308    def _addPathnames(self, root, names): 
    309309        """ 
     
    313313        cmd = [DARCS_CMD, "add", "--case-ok", "--not-recursive", "--quiet"] 
    314314        ExternalCommand(cwd=root, command=cmd).execute(names) 
    315          
     315 
    316316    def _addSubtree(self, root, subdir): 
    317317        """ 
     
    321321        cmd = [DARCS_CMD, "add", "--case-ok", "--recursive", "--quiet"] 
    322322        ExternalCommand(cwd=root, command=cmd).execute(subdir) 
    323          
     323 
    324324    def _commit(self, root, date, author, remark, changelog=None, entries=None): 
    325325        """ 
     
    328328 
    329329        from sys import getdefaultencoding 
    330          
     330 
    331331        encoding = ExternalCommand.FORCE_ENCODING or getdefaultencoding() 
    332332 
     
    342342        if not entries: 
    343343            entries = ['.'] 
    344              
     344 
    345345        record = ExternalCommand(cwd=root, command=cmd) 
    346346        record.execute(entries, input='\n'.join(logmessage), stdout=PIPE) 
    347          
     347 
    348348        if record.exit_status: 
    349349            raise ChangesetApplicationFailure( 
    350350                "%s returned status %d" % (str(record), record.exit_status)) 
    351          
     351 
    352352    def _removePathnames(self, root, names): 
    353353        """ 
     
    357357        # Since the source VCS already deleted the entry, and given that 
    358358        # darcs will do the right thing with it, do nothing here, instead 
    359         # of  
     359        # of 
    360360        #         c = ExternalCommand(cwd=root, 
    361361        #                             command=[DARCS_CMD, "remove"]) 
     
    364364 
    365365        pass 
    366      
     366 
    367367    def _renamePathname(self, root, oldname, newname): 
    368368        """ 
     
    372372        from os.path import join, exists 
    373373        from os import rename 
    374          
     374 
    375375        # Check to see if the oldentry is still there. If it does, 
    376376        # that probably means one thing: it's been moved and then 
     
    416416        ignored = [line for line in boring if line <> '\.cvsignore$\n'] 
    417417        boring.close() 
    418          
     418 
    419419        # Augment the boring file, that contains a regexp per line 
    420420        # with all known VCs metadirs to be skipped. 
     
    425425        boring.write('\n^tailor.log$\n^tailor.info$\n') 
    426426        boring.close() 
    427          
     427 
    428428        SyncronizableTargetWorkingDir._initializeWorkingDir(self, root, 
    429429                                                            repository, module, 
Note: See TracChangeset for help on using the changeset viewer.