From d8ed8bd84cb5f37ebda2bb4dbf18b0bd7faacd0c Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 15 Jan 2013 16:28:24 +0200 Subject: gbp-pull: implement --all cmdline option This updates all remote-tracking branches (for the remote that is fetched from) whose local branch name is identical to the remote branch name. Signed-off-by: Markus Lehtonen --- tests/component/deb/test_pull.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/component/deb/test_pull.py b/tests/component/deb/test_pull.py index 53588f6f..34fc3044 100644 --- a/tests/component/deb/test_pull.py +++ b/tests/component/deb/test_pull.py @@ -50,3 +50,32 @@ class TestPull(ComponentTestBase): self._check_repo_state(cloned, 'master', ['master']) eq_(pull(['argv0']), 0) assert len(repo.get_commits()) == 1 + + @RepoFixtures.quilt30() + def test_pull_all(self, repo): + """Test the '--all' commandline option""" + # Create new branch in repo + repo.create_branch('foob') + + # Clone and create new commits in origin + dest = os.path.join(self._tmpdir, 'cloned_repo') + clone(['arg0', '--all', repo.path, dest]) + cloned = ComponentTestGitRepository(dest) + tmp_workdir = os.path.join(self._tmpdir, 'tmp_workdir') + os.mkdir(tmp_workdir) + with open(os.path.join(tmp_workdir, 'new_file'), 'w'): + pass + repo.commit_dir(tmp_workdir, 'New commit in master', branch='master') + repo.commit_dir(tmp_workdir, 'New commit in foob', branch='foob') + + # Check that the branch is not updated when --all is not used + eq_(pull(['argv0']), 0) + eq_(len(cloned.get_commits(until='master')), 3) + eq_(len(cloned.get_commits(until='upstream')), 1) + eq_(len(cloned.get_commits(until='foob')), 2) + + # Check that --all updates all branches + repo.commit_dir(tmp_workdir, 'New commit in upstream', branch='upstream') + eq_(pull(['argv0', '--all']), 0) + eq_(len(cloned.get_commits(until='foob')), 3) + eq_(len(cloned.get_commits(until='upstream')), 2) -- cgit v1.2.3