/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_generic_processor.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-12 08:02:42 UTC
  • mto: (0.64.267 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: john@arbash-meinel.com-20091112080242-hwu75y5s9ku6nd53
add the failing test that we preserve the last-modified revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
1832
1832
    def test_import_symlink(self):
1833
1833
        handler, branch = self.get_handler()
1834
1834
        handler.process(self.get_command_iter('foo', 'symlink', 'bar'))
 
1835
 
 
1836
 
 
1837
class TestModifyRevertInBranch(TestCaseForGenericProcessor):
 
1838
 
 
1839
    def file_command_iter(self):
 
1840
        # A     add 'foo'
 
1841
        # |\
 
1842
        # | B   modify 'foo'
 
1843
        # | |
 
1844
        # | C   revert 'foo' back to A
 
1845
        # |/
 
1846
        # D     merge 'foo'
 
1847
        def command_list():
 
1848
            committer_a = ['', 'elmer@a.com', time.time(), time.timezone]
 
1849
            committer_b = ['', 'elmer@b.com', time.time(), time.timezone]
 
1850
            committer_c = ['', 'elmer@c.com', time.time(), time.timezone]
 
1851
            committer_d = ['', 'elmer@d.com', time.time(), time.timezone]
 
1852
            def files_one():
 
1853
                yield commands.FileModifyCommand('foo', 'file', False,
 
1854
                        None, "content A\n")
 
1855
            yield commands.CommitCommand('head', '1', None,
 
1856
                committer_a, "commit 1", None, [], files_one)
 
1857
            def files_two():
 
1858
                yield commands.FileModifyCommand('foo', 'file', False,
 
1859
                        None, "content B\n")
 
1860
            yield commands.CommitCommand('head', '2', None,
 
1861
                committer_b, "commit 2", ":1", [], files_two)
 
1862
            def files_three():
 
1863
                yield commands.FileModifyCommand('foo', 'file', False,
 
1864
                        None, "content A\n")
 
1865
            yield commands.CommitCommand('head', '3', None,
 
1866
                committer_c, "commit 3", ":2", [], files_three)
 
1867
            def files_four():
 
1868
                if False:
 
1869
                    yield None
 
1870
            yield commands.CommitCommand('head', '4', None,
 
1871
                committer_d, "commit 4", ":1", [':3'], files_four)
 
1872
        return command_list
 
1873
 
 
1874
    def test_modify_revert(self):
 
1875
        handler, branch = self.get_handler()
 
1876
        handler.process(self.file_command_iter())
 
1877
        last_rev = branch.last_revision()
 
1878
        rtree = branch.repository.revision_tree(last_rev)
 
1879
        parent_ids = rtree.get_parent_ids()
 
1880
        self.assertEqual(2, len(parent_ids))
 
1881
        foo_id = rtree.path2id('foo')
 
1882
        self.assertEqual(parent_ids[1], rtree.inventory[foo_id].revision)