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-06-05 17:27:18 +0300 |
commit | dca47ece0d2f0de035dc1d2199ac9716ab9b559f (patch) | |
tree | 9bed5d5f1efd2053d00320c3ddbac52e223212a6 /tests/component/rpm | |
parent | d673c34ada960fbe47014d1795772378e3f6f2df (diff) | |
download | git-buildpackage-dca47ece0d2f0de035dc1d2199ac9716ab9b559f.tar.gz git-buildpackage-dca47ece0d2f0de035dc1d2199ac9716ab9b559f.tar.bz2 git-buildpackage-dca47ece0d2f0de035dc1d2199ac9716ab9b559f.zip |
rpm-ch: implement --commit option
Change-Id: I89b05175d3c4f3def796b20b4e65c53af7d96d13
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/component/rpm')
-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') |