Changeset 39 in tailor


Ignore:
Timestamp:
06/27/04 03:59:28 (9 years ago)
Author:
lele@…
Hash name:
20040627015928-97f81-db032f1503420bba9d7a0706ce5394be055cdd1e
Message:

Little fixes and annotations on cvs backend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/cvs.py

    r37 r39  
    117117        changesets = [] 
    118118        log = cvsps(output=True, update=True, branch=branch) 
    119         for cs in self.__enumerateChangesets(log): 
    120             if not startfrom_rev or (startfrom_rev<=int(cs.revision)): 
    121                 changesets.append(cs) 
     119        for cs in self.__enumerateChangesets(log, startfrom_rev): 
     120            changesets.append(cs) 
    122121 
    123122        return changesets 
    124123     
    125     def __enumerateChangesets(self, log): 
     124    def __enumerateChangesets(self, log, startfrom_rev): 
    126125        """ 
    127126        Parse CVSps log. 
     
    179178 
    180179            while l.startswith('\t'): 
    181                 file,revs = l[1:-1].split(':') 
    182                 fromrev,torev = revs.split('->') 
    183  
    184                 e = ChangesetEntry(file) 
    185                 e.old_revision = fromrev 
    186                 e.new_revision = torev 
    187  
    188                 if fromrev=='INITIAL': 
    189                     e.action_kind = e.ADDED 
    190                 elif "(DEAD)" in torev: 
    191                     e.action_kind = e.DELETED 
    192                 else: 
    193                     e.action_kind = e.UPDATED 
    194  
    195                 entries.append(e) 
     180                if not startfrom_rev or (startfrom_rev<=int(pset['revision'])): 
     181                    file,revs = l[1:-1].split(':') 
     182                    fromrev,torev = revs.split('->') 
     183 
     184                    e = ChangesetEntry(file) 
     185                    e.old_revision = fromrev 
     186                    e.new_revision = torev 
     187 
     188                    if fromrev=='INITIAL': 
     189                        e.action_kind = e.ADDED 
     190                    elif "(DEAD)" in torev: 
     191                        e.action_kind = e.DELETED 
     192                    else: 
     193                        e.action_kind = e.UPDATED 
     194 
     195                    entries.append(e) 
     196                     
    196197                l = log.readline() 
    197198 
    198             cvsdate = pset['date'] 
    199             y,m,d = map(int, cvsdate[:10].split('/')) 
    200             hh,mm,ss = map(int, cvsdate[11:19].split(':')) 
    201             timestamp = datetime(y, m, d, hh, mm, ss) 
    202             pset['date'] = timestamp 
     199            if not startfrom_rev or (startfrom_rev<=int(pset['revision'])): 
     200                cvsdate = pset['date'] 
     201                y,m,d = map(int, cvsdate[:10].split('/')) 
     202                hh,mm,ss = map(int, cvsdate[11:19].split(':')) 
     203                timestamp = datetime(y, m, d, hh, mm, ss) 
     204                pset['date'] = timestamp 
    203205             
    204             yield Changeset(**pset) 
     206                yield Changeset(**pset) 
    205207 
    206208    def _applyChangeset(self, root, changeset): 
     209        from os.path import join, exists, dirname 
     210        from os import makedirs 
     211         
    207212        cvsup = CvsUpdate(working_dir=root) 
    208213        for e in changeset.entries: 
     214            edir = dirname(join(root, e.name)) 
     215            if e.action_kind != e.DELETED and not exists(edir)): 
     216                makedirs(edir) 
     217 
    209218            cvsup(entry=e.name, revision=e.new_revision) 
     219 
     220            if e.action_kind == e.DELETED: 
     221                # XXX: should drop edir if empty 
     222                pass 
     223                 
    210224        self.__setLastUpstreamRevision(root, changeset.revision) 
    211          
     225 
     226 
    212227    ## SyncronizableTargetWorkingDir 
    213228 
     
    238253 
    239254        # update cvsps cache and get its last CVS "revision" 
     255 
     256        # XXX: this is wrong, as it assumes we extracted HEAD! 
     257         
    240258        wdir = join(basedir, module) 
    241259        csets = self._getUpstreamChangesets(wdir) 
Note: See TracChangeset for help on using the changeset viewer.