aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-01-15 16:28:24 +0200
committerGuido Günther <agx@sigxcpu.org>2018-01-23 08:22:02 +0100
commitd8ed8bd84cb5f37ebda2bb4dbf18b0bd7faacd0c (patch)
treef8cf8a49e7ae1e3fcd3950c6dc72fa6251323ccc /tests
parent9b28cffc6083efeb4d8fd729c9be7a29767b8c77 (diff)
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 <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/component/deb/test_pull.py29
1 files changed, 29 insertions, 0 deletions
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)