Exemplo n.º 1
0
 def test_with_tz_datetime(self, git: Git):
     (git.path / 'a').write_text('content')
     dt = datetime(2001, 1, 1, 10).astimezone(timezone.utc)
     git.commit('a commit', dt, dt)
     compare(
         git('log', '--format=%aI %cI'),
         expected='2001-01-01T10:00:00+00:00 2001-01-01T10:00:00+00:00\n')
Exemplo n.º 2
0
 def test_from_empty(self, git: Git):
     (git.path / 'a').write_text('content')
     git.commit('a commit')
     compare(git.git('status', '-s'), expected='')
     commit, = git.git('log', '--format=%h').split()
     compare(git.git('show', '--pretty=format:%s', '--stat', commit),
             expected=('a commit\n'
                       ' a | 1 +\n'
                       ' 1 file changed, 1 insertion(+)\n'))
Exemplo n.º 3
0
 def test_with_dates_as_strings(self, git: Git):
     (git.path / 'content.txt').write_text('content')
     git.commit(
         'commit',
         author_date='format:iso8601:' + datetime(2000, 1, 1).isoformat(),
         commit_date='format:iso8601:' + datetime(2000, 1, 2).isoformat())
     compare(git('log', '--pretty=format:%ad'),
             expected='Sat Jan 1 00:00:00 2000 +0000')
     compare(git('log', '--pretty=format:%cd'),
             expected='Sun Jan 2 00:00:00 2000 +0000')
Exemplo n.º 4
0
 def test_clone_non_testing(self, git: Git):
     (git.path / 'a').write_text('content')
     git.commit('a commit')
     clone = Repo.clone(git, 'clone')
     assert isinstance(clone, Repo)
     commit, = clone.git('log', '--format=%h').split()
     compare(clone.git('show', '--pretty=format:%s', '--stat', commit), expected=(
         'a commit\n'
         ' a | 1 +\n'
         ' 1 file changed, 1 insertion(+)\n'
     ))
Exemplo n.º 5
0
 def test_from_one_commit(self, git: Git):
     (git.path / 'a').write_text('a content')
     (git.path / 'b').write_text('b content')
     (git.path / 'c').write_text('c content')
     git.commit('commit 1')
     (git.path / 'b').write_text('new content')
     (git.path / 'c').unlink()
     (git.path / 'd').write_text('d content')
     git.commit('commit 2')
     compare(git.git('status', '-s'), expected='')
     commit2, commit1 = git.git('log', '--format=%h').split()
     compare(git.git('show', '--pretty=format:%s', '--stat', commit1),
             expected=('commit 1\n'
                       ' a | 1 +\n'
                       ' b | 1 +\n'
                       ' c | 1 +\n'
                       ' 3 files changed, 3 insertions(+)\n'))
     compare(
         git.git('show', '--pretty=format:%s', '--stat', commit2),
         expected=('commit 2\n'
                   ' b | 2 +-\n'
                   ' c | 1 -\n'
                   ' d | 1 +\n'
                   ' 3 files changed, 2 insertions(+), 2 deletions(-)\n'))
Exemplo n.º 6
0
 def test_with_committer_date(self, git: Git):
     (git.path / 'content.txt').write_text('content')
     git.commit('commit', commit_date=datetime(2000, 1, 1))
     compare(git('log', '--pretty=format:%cd'),
             expected='Sat Jan 1 00:00:00 2000 +0000')