Edgewall Software

Changeset 8345

Show
Ignore:
Timestamp:
07/02/09 13:45:34 (2 days ago)
Author:
cboos
Message:

0.11.5dev: add unit tests for SubversionNode.get_copy_ancestry.

Location:
branches/0.11-stable/trac/versioncontrol
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11-stable/trac/versioncontrol/svn_fs.py

    r8332 r8345  
    788788 
    789789    def get_copy_ancestry(self): 
     790        """Retrieve the list of `(path,rev)` copy ancestors of this node. 
     791        Most recent ancestor first. Each ancestor `(path, rev)` corresponds  
     792        to the path and revision of the source at the time the copy or move 
     793        operation was performed. 
     794        """ 
    790795        ancestors = [] 
    791796        previous = (self._scoped_path_utf8, self._requested_rev, self.root) 
  • branches/0.11-stable/trac/versioncontrol/tests/svn_fs.py

    r8195 r8345  
    242242        self.assertRaises(StopIteration, history.next) 
    243243 
     244    def test_get_copy_ancestry(self): 
     245        node = self.repos.get_node('/tags/v1/README.txt') 
     246        ancestry = node.get_copy_ancestry() 
     247        self.assertEqual([(u'tête/README.txt', 6)], ancestry) 
     248        for path, rev in ancestry: 
     249            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     250 
     251        node = self.repos.get_node(u'/tête/README3.txt') 
     252        ancestry = node.get_copy_ancestry() 
     253        self.assertEqual([(u'tête/README2.txt', 13),  
     254                          (u'tête/README.txt', 3)], ancestry) 
     255        for path, rev in ancestry: 
     256            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     257 
     258        node = self.repos.get_node('/branches/v1x') 
     259        ancestry = node.get_copy_ancestry() 
     260        self.assertEqual([(u'tags/v1.1', 11), 
     261                          (u'branches/v1x', 9),  
     262                          (u'tags/v1', 7),  
     263                          (u'tête', 6)], ancestry) 
     264        for path, rev in ancestry: 
     265            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     266 
     267    def test_get_copy_ancestry_for_move(self): 
     268        node = self.repos.get_node(u'/tête/dir1/dir2', 5) 
     269        ancestry = node.get_copy_ancestry() 
     270        self.assertEqual([(u'tête/dir2', 4)], ancestry) 
     271        for path, rev in ancestry: 
     272            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     273 
    244274    # Revision Log / path history  
    245275 
     
    584614        self.assertRaises(StopIteration, history.next) 
    585615 
     616    def test_get_copy_ancestry(self): 
     617        node = self.repos.get_node(u'/README3.txt') 
     618        ancestry = node.get_copy_ancestry() 
     619        self.assertEqual([(u'README2.txt', 13),  
     620                          (u'README.txt', 3)], ancestry) 
     621        for path, rev in ancestry: 
     622            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     623 
     624    def test_get_copy_ancestry_for_move(self): 
     625        node = self.repos.get_node(u'/dir1/dir2', 5) 
     626        ancestry = node.get_copy_ancestry() 
     627        self.assertEqual([(u'dir2', 4)], ancestry) 
     628        for path, rev in ancestry: 
     629            self.repos.get_node(path, rev) # shouldn't raise NoSuchNode 
     630 
    586631    # Revision Log / path history  
    587632