

def test_simple(self):
    vcs = self.get_vcs()
    vcs.clone()
    vcs.update()
    revision = vcs.log(parent='HEAD', limit=1).next()
    assert (len(revision.id) == 40)
    self.assertRevision(revision, author='Foo Bar <foo@example.com>', message='biz\nbaz\n', subject='biz')
    revisions = list(vcs.log())
    assert (len(revisions) == 2)
    assert (revisions[0].subject == 'biz')
    assert (revisions[0].message == 'biz\nbaz\n')
    assert (revisions[0].author == 'Foo Bar <foo@example.com>')
    assert (revisions[0].committer == 'Foo Bar <foo@example.com>')
    assert (revisions[0].parents == [revisions[1].id])
    assert (revisions[0].author_date == revisions[0].committer_date is not None)
    assert (revisions[0].branches == ['master'])
    assert (revisions[1].subject == 'test')
    assert (revisions[1].message == 'test\nlol\n')
    assert (revisions[1].author == 'Foo Bar <foo@example.com>')
    assert (revisions[1].committer == 'Foo Bar <foo@example.com>')
    assert (revisions[1].parents == [])
    assert (revisions[1].author_date == revisions[1].committer_date is not None)
    assert (revisions[1].branches == ['master'])
    diff = vcs.export(revisions[0].id)
    assert (diff == 'diff --git a/BAR b/BAR\nnew file mode 100644\nindex 0000000..e69de29\n')
    assert (vcs.get_changed_files(revisions[0].id) == set(['BAR']))
    revisions = list(vcs.log(offset=0, limit=1))
    assert (len(revisions) == 1)
    assert (revisions[0].subject == 'biz')
    revisions = list(vcs.log(offset=1, limit=1))
    assert (len(revisions) == 1)
    assert (revisions[0].subject == 'test')

dataset/ETHPy150Open dropbox/changes/tests/changes/vcs/test_git.py GitVcsTest.test_simple/original