diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-05 16:37:25 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:47:20 +0200 |
commit | 17e6d72c9727d501b73df5dafa05f40f0593fe34 (patch) | |
tree | 874588356a445d3a2cf8191c0e8a04d66de66720 /tests | |
parent | 355574c5c092c568ce0a2212327b375f22835859 (diff) | |
download | git-buildpackage-17e6d72c9727d501b73df5dafa05f40f0593fe34.tar.gz git-buildpackage-17e6d72c9727d501b73df5dafa05f40f0593fe34.tar.bz2 git-buildpackage-17e6d72c9727d501b73df5dafa05f40f0593fe34.zip |
rpm-ch: implement --commit option
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/component/rpm/test_rpm_ch.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/component/rpm/test_rpm_ch.py b/tests/component/rpm/test_rpm_ch.py index 968cfd4a..b8c3bcaf 100644 --- a/tests/component/rpm/test_rpm_ch.py +++ b/tests/component/rpm/test_rpm_ch.py @@ -265,6 +265,28 @@ class TestRpmCh(RpmRepoTestBase): header = self.read_file('packaging/gbp-test-native.changes')[0] ok_(re.match(r'.+ foobar$', header)) + def test_option_commit(self): + """Test the --commit cmdline option""" + repo = self.init_test_repo('gbp-test') + + # Check unclean repo + with open('untracked-file', 'w') as fobj: + fobj.write('this file is not tracked\n') + with open('foo.txt', 'a') as fobj: + fobj.write('new stuff\n') + + # Unstaged file (foo.txt) -> failure + eq_(mock_ch(['--commit', '--since=HEAD^']), 1) + self._check_log(-1, 'gbp:error: Please commit or stage your changes') + + # Add file, update and commit, untracked file should be ignored + repo.add_files('foo.txt') + sha = repo.rev_parse('HEAD') + eq_(mock_ch(['--commit', '--since=HEAD^']), 0) + eq_(sha, repo.rev_parse('HEAD^')) + eq_(repo.get_commit_info('HEAD')['files'], + {'M': ['foo.txt', 'gbp-test.spec']}) + def test_tagging(self): """Test commiting/tagging""" repo = self.init_test_repo('gbp-test-native') |