Changeset 1649 in tailor


Ignore:
Timestamp:
07/17/08 23:06:14 (5 years ago)
Author:
lele@…
Hash name:
20080717210614-97f81-8a68a90caeb65f5350c16220ba8d117384348eca
Message:

Substitute REPLACED with RENAMED when it is the case
This is not enough and there are still problems with the REPLACED kind
of entries: when it's a directory that gets replaced, tailor should go
down the slipping route of adding REMOVEs for entries that were
effectively deleted...

Location:
vcpx
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • vcpx/repository/svn.py

    r1620 r1649  
    294294                # outside of this module: 
    295295                #  D -> Remove entry completely (it's not going to be in here) 
    296                 #  (M,A,R) -> A 
     296                #  (M,A) -> A 
     297 
     298                # Finally, take care of the 'R' entries: if the entry 
     299                # is a target of a rename, just discard it (hopefully 
     300                # the target VC will do the right thing), otherwise 
     301                # change those to 'A'. 
    297302 
    298303                mv_or_cp = {} 
    299304                for e in self.current['entries']: 
    300                     if e.action_kind == e.ADDED and e.old_name is not None: 
     305                    if (e.action_kind == e.ADDED or 
     306                        e.action_kind == 'R') and e.old_name is not None: 
    301307                        mv_or_cp[e.old_name] = e 
    302308 
     
    334340                        else: 
    335341                            check_renames_from_dir(e.name) 
    336                         e.action_kind = e.ADDED 
     342 
     343                        # Another scenario is 
     344                        #   $ svn mv dir otherdir 
     345                        #   $ svn rm otherdir/subdir 
     346                        #   $ svn mv olddir/subdir otherdir 
     347                        #   $ svn rm olddir 
     348                        if e.old_name is not None: 
     349                            e.action_kind = e.RENAMED 
     350                        else: 
     351                            e.action_kind = e.ADDED 
    337352                        entries2.append(e) 
    338353                    elif parent_was_copied(e.name): 
  • vcpx/tests/svn.py

    r1539 r1649  
    164164        self.assertRaises(StopIteration, csets.next) 
    165165 
     166    def testRenameReplace(self): 
     167        """Verify how tailor handle svn "R" event on renames""" 
     168 
     169        log = self.getSvnLog('svn-rename_replace') 
     170        csets = changesets_from_svnlog(log, FR('file:///tmp/rep', 
     171                                               '/cedar-backup2/trunk')) 
     172 
     173        cset = csets.next() 
     174        self.assertEqual(len(cset.entries), 7) 
     175        for entry, expected in map(None, cset.entries, 
     176                                   (('Makefile', 'UPD'), 
     177                                    ('test', 'REN', 'unittest'), 
     178                                    ('test/__init__.py', 'ADD'), 
     179                                    ('test/filesystemtests.py', 'ADD'), 
     180                                    ('test/knapsacktests.py', 'ADD'), 
     181                                    ('util/createtree.py', 'UPD'), 
     182                                    ('test/data', 'REN', 'unittest/data'))): 
     183            self.assertEqual(entry.name, expected[0]) 
     184            self.assertEqual(entry.action_kind, expected[1], 
     185                             msg=entry.name+': got %r, expected %r' % 
     186                             (entry.action_kind, expected[1])) 
     187            if expected[1]=='REN': 
     188                self.assertEqual(entry.old_name, expected[2], 
     189                                 msg=entry.name+': got %r, expected %r' % 
     190                                 (entry.old_name, expected[2])) 
     191 
    166192    def testTrackingRoot(self): 
    167193        """Verify we are able to track the root of the repository""" 
     
    207233        entry = cset.entries[2] 
    208234        self.assertEqual(entry.name, 'py/documentation/example/test') 
    209         self.assertEqual(entry.action_kind, entry.ADDED) 
     235        self.assertEqual(entry.action_kind, entry.RENAMED) 
     236        self.assertEqual(entry.old_name, 'example/test') 
    210237 
    211238        self.assertRaises(StopIteration, csets.next) 
Note: See TracChangeset for help on using the changeset viewer.