Пример #1
0
 def test_hg_plugin_reup(self):
     repo = HgRepo(self.content_dir)
     default_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'default'
         ).split()[0]
     plugin_fields = {'url': self.content_dir}
     # By default, the hg plugin should reup from default.
     expected_output = {'rev': default_tip}
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Add some new commits and make sure master gets fetched properly.
     shared.write_files(self.content_dir, {
         'randomfile': "hg doesn't like empty commits"})
     repo.run('hg', 'commit', '-A', '-m', 'junk')
     shared.write_files(self.content_dir, {
         'randomfile': "hg still doesn't like empty commits"})
     repo.run('hg', 'branch', 'newbranch')
     repo.run('hg', 'commit', '-A', '-m', 'more junk')
     new_default_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'default'
         ).split()[0]
     expected_output['rev'] = new_default_tip
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Now specify the reup target explicitly.
     newbranch_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'tip'
         ).split()[0]
     plugin_fields['reup'] = 'newbranch'
     expected_output['rev'] = newbranch_tip
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)
Пример #2
0
 def test_hg_plugin_reup(self):
     repo = HgRepo(self.content_dir)
     default_tip = repo.run("hg identify --debug -r default").split()[0]
     plugin_fields = {"url": self.content_dir}
     # By default, the hg plugin should reup from default.
     expected_output = {"rev": default_tip}
     output = plugin_get_reup_fields(
         self.plugin_context, "hg", plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Add some new commits and make sure master gets fetched properly.
     shared.write_files(self.content_dir, {
         'randomfile': "hg doesn't like empty commits"})
     repo.run("hg commit -A -m 'junk'")
     shared.write_files(self.content_dir, {
         'randomfile': "hg still doesn't like empty commits"})
     repo.run("hg branch newbranch")
     repo.run("hg commit -A -m 'more junk'")
     new_default_tip = repo.run("hg identify --debug -r default").split()[0]
     expected_output["rev"] = new_default_tip
     output = plugin_get_reup_fields(
         self.plugin_context, "hg", plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Now specify the reup target explicitly.
     newbranch_tip = repo.run("hg identify --debug -r tip").split()[0]
     plugin_fields["reup"] = "newbranch"
     expected_output["rev"] = newbranch_tip
     output = plugin_get_reup_fields(
         self.plugin_context, "hg", plugin_fields)
     self.assertDictEqual(expected_output, output)
Пример #3
0
 def test_hg_plugin_multiple_fetches(self):
     content_repo = HgRepo(self.content_dir)
     head = content_repo.run("hg identify --debug -r .").split()[0]
     plugin_fields = {"url": self.content_dir, "rev": head}
     output = self.do_plugin_test("hg", plugin_fields, self.content)
     self.assertEqual(output.count("hg clone"), 1)
     self.assertEqual(output.count("hg pull"), 0)
     # Add a new file to the directory and commit it.
     shared.write_files(self.content_dir, {'another': 'file'})
     content_repo.run("hg commit -A -m 'committing another file'")
     # Refetch the original rev. Hg should not do a pull.
     output = self.do_plugin_test("hg", plugin_fields, self.content)
     self.assertEqual(output.count("hg clone"), 0)
     self.assertEqual(output.count("hg pull"), 0)
     # Not delete the rev field. Git should default to master and fetch.
     del plugin_fields["rev"]
     self.content["another"] = "file"
     output = self.do_plugin_test("hg", plugin_fields, self.content)
     self.assertEqual(output.count("hg clone"), 0)
     self.assertEqual(output.count("hg pull"), 1)
Пример #4
0
 def test_hg_plugin_multiple_fetches(self):
     content_repo = HgRepo(self.content_dir)
     head = content_repo.run('hg', 'identify', '--debug', '-r',
                             '.').split()[0]
     plugin_fields = {'url': self.content_dir, 'rev': head}
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 1)
     self.assertEqual(output.count('hg pull'), 0)
     # Add a new file to the directory and commit it.
     shared.write_files(self.content_dir, {'another': 'file'})
     content_repo.run('hg', 'commit', '-A', '-m', 'committing another file')
     # Refetch the original rev. Hg should not do a pull.
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 0)
     self.assertEqual(output.count('hg pull'), 0)
     # Not delete the rev field. Git should default to master and fetch.
     del plugin_fields['rev']
     self.content['another'] = 'file'
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 0)
     self.assertEqual(output.count('hg pull'), 1)
Пример #5
0
 def test_hg_plugin_multiple_fetches(self):
     content_repo = HgRepo(self.content_dir)
     head = content_repo.run('hg', 'identify', '--debug', '-r',
                             '.').split()[0]
     plugin_fields = {'url': self.content_dir, 'rev': head}
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 1)
     self.assertEqual(output.count('hg pull'), 0)
     # Add a new file to the directory and commit it.
     shared.write_files(self.content_dir, {'another': 'file'})
     content_repo.run('hg', 'commit', '-A', '-m', 'committing another file')
     # Refetch the original rev. Hg should not do a pull.
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 0)
     self.assertEqual(output.count('hg pull'), 0)
     # Not delete the rev field. Git should default to master and fetch.
     del plugin_fields['rev']
     self.content['another'] = 'file'
     output = self.do_plugin_test('hg', plugin_fields, self.content)
     self.assertEqual(output.count('hg clone'), 0)
     self.assertEqual(output.count('hg pull'), 1)
Пример #6
0
 def test_hg_plugin(self):
     HgRepo(self.content_dir)
     self.do_plugin_test("hg", {"url": self.content_dir}, self.content)
Пример #7
0
 def test_hg_plugin_reup(self):
     repo = HgRepo(self.content_dir)
     default_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'default'
         ).split()[0]
     plugin_fields = {'url': self.content_dir}
     # By default, the hg plugin should reup from default.
     expected_output = {'rev': default_tip}
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Add some new commits and make sure master gets fetched properly.
     shared.write_files(self.content_dir, {
         'randomfile': "hg doesn't like empty commits"})
     repo.run('hg', 'commit', '-A', '-m', 'junk')
     shared.write_files(self.content_dir, {
         'randomfile': "hg still doesn't like empty commits"})
     repo.run('hg', 'branch', 'newbranch')
     repo.run('hg', 'commit', '-A', '-m', 'more junk')
     new_default_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'default'
         ).split()[0]
     expected_output['rev'] = new_default_tip
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)
     # Now specify the reup target explicitly.
     newbranch_tip = repo.run(
         'hg', 'identify', '--debug', '-r', 'tip'
         ).split()[0]
     plugin_fields['reup'] = 'newbranch'
     expected_output['rev'] = newbranch_tip
     output = test_plugin_get_reup_fields(
         self.plugin_context, 'hg', plugin_fields)
     self.assertDictEqual(expected_output, output)