Changeset 962 in tailor


Ignore:
Timestamp:
10/27/05 09:56:59 (8 years ago)
Author:
R.Ghetta <birrachiara@…>
Hash name:
20051027075659-2c016-1b169d8c9c03e1c7f7d8e86057afafcbb916bfa2
Message:

hack to generate pseudo-add-dir entries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/monotone.py

    r961 r962  
    311311        self.repository = repository 
    312312 
     313    def _addPathToSet(self, s, dirs): 
     314        for d in xrange(0,len(dirs)): 
     315            nd = '/'.join(dirs[0:d]) 
     316            s.add( nd ); 
     317     
    313318    def convertDiff(self, chset): 
    314319        """ 
     
    337342                "monotone diff returned status %d" % mtl.exit_status) 
    338343 
     344        implicit_dirs_add = set() 
     345        dirs_add = set() 
     346                 
    339347        # monotone diffs are prefixed by a section containing 
    340348        # metainformations about files 
     
    361369 
    362370                    # ok, is a file, control changesets data 
    363                     if token == "add_file" or token=="add_directory": 
     371                    if token == "add_file": 
    364372                        chentry = chset.addEntry(fname[1:-1], chset.revision) 
    365373                        chentry.action_kind = chentry.ADDED 
     374                        # split filespec in parts, skipping the filename 
     375                        # (monotone always uses '/' as path separator) 
     376                        self._addPathToSet(implicit_dirs_add, "/".split(chentry.name)[:-1]); 
     377                    elif token=="add_directory": 
     378                        chentry = chset.addEntry(fname[1:-1], chset.revision) 
     379                        chentry.action_kind = chentry.ADDED 
     380                        self._addPathToSet(dirs_add, "/".split(chentry.name)); 
    366381                    elif token == "delete_file" or token=="delete_directory": 
    367382                        chentry = chset.addEntry(fname[1:-1], chset.revision) 
     
    378393                        chentry.action_kind = chentry.RENAMED 
    379394                        chentry.old_name= fname[1:-1] 
     395                        if token=="rename_directory": 
     396                            self._addPathToSet(dirs_add, "/".split(chentry.name)) 
    380397                    elif token == "patch": 
    381398                        # patch entries are in the form: from oldrev to newrev 
     
    401418            if in_item: 
    402419                raise GetUpstreamChangesetsFailure("Unexpected end of 'diff' parsing changeset info") 
     420 
     421        # remove explicit dir adds from implicit set, then create "add" changesets 
     422        # for the remaining dirs 
     423        implicit_dirs_add = implicit_dirs_add.difference(dirs_add) 
     424        for d in implicit_dirs_add: 
     425            chentry = chset.addEntry(d, chset.revision) 
     426            chentry.action_kind = chentry.ADDED 
    403427 
    404428 
Note: See TracChangeset for help on using the changeset viewer.