Example #1
0
 def test_simple_merge_from_existing_git(self):
     # Launched from an existing git repository
     remotes = [{
         'name': 'r1',
         'url': self.url_remote1
     }, {
         'name': 'r2',
         'url': self.url_remote2
     }]
     merges = [{
         'remote': 'r1',
         'ref': 'tag1'
     }, {
         'remote': 'r2',
         'ref': self.commit_3_sha
     }]
     target = {
         'remote': 'r1',
         'branch': 'agg'
     }
     subprocess.call(['git', 'init', self.cwd])
     repo = Repo(self.cwd, remotes, merges, target, fetch_all=True)
     repo.aggregate()
     last_rev = git_get_last_rev(self.cwd)
     self.assertEqual(last_rev, self.commit_3_sha)
     # push
     repo.push()
     rtype, ref, sha = list(repo.query_remote('r1', 'agg'))[0]
     self.assertEquals(rtype, 'branch')
     self.assertTrue(sha)
Example #2
0
 def test_simple_merge(self):
     remotes = [{
         'name': 'r1',
         'url': self.url_remote1
     }, {
         'name': 'r2',
         'url': self.url_remote2
     }]
     merges = [{
         'remote': 'r1',
         'ref': 'tag1'
     }, {
         'remote': 'r2',
         'ref': self.commit_3_sha
     }]
     target = {
         'remote': 'r1',
         'branch': 'agg'
     }
     repo = Repo(self.cwd, remotes, merges, target)
     repo.aggregate()
     last_rev = git_get_last_rev(self.cwd)
     self.assertEqual(last_rev, self.commit_3_sha)
     # push
     repo.push()
     rtype, sha = repo.query_remote_ref('r1', 'agg')
     self.assertEquals(rtype, 'branch')
     self.assertTrue(sha)
Example #3
0
 def test_push_missing_remote(self):
     remotes = [{
         'name': 'r1',
         'url': self.url_remote1
     }, {
         'name': 'r2',
         'url': self.url_remote2
     }]
     merges = [{
         'remote': 'r1',
         'ref': 'tag1'
     }, {
         'remote': 'r2',
         'ref': self.commit_3_sha
     }]
     target = {'remote': None, 'branch': 'agg'}
     repo = Repo(self.cwd, remotes, merges, target, fetch_all=True)
     repo.aggregate()
     with self.assertRaises(exception.GitAggregatorException) as ex:
         repo.push()
     self.assertEquals(ex.exception.args[0],
                       "Cannot push agg, no target remote configured")