Пример #1
0
  def tag(clazz, root_dir, tag, allow_downgrade = False, push = False,
          commit = None, annotation = None):
    check.check_string(root_dir)
    check.check_string(tag)
    check.check_bool(allow_downgrade)
    check.check_bool(push)
    check.check_string(commit, allow_none = True)
    check.check_string(annotation, allow_none = True)

    if not allow_downgrade:
      greatest_tag = git.greatest_local_tag(root_dir)
      if greatest_tag:
        if software_version.compare(greatest_tag.name, tag) >= 0:
          raise ValueError('new tag \"{}\" is older than \"{}\".  Use allow_downgrade to force it.'.format(tag,
                                                                                                           greatest_tag.name))
    if not commit:
      commit = clazz.last_commit_hash(root_dir, short_hash = True)
    args = [ 'tag', tag, commit ]
    if annotation:
      args.append('--annotate')
      args.append('--message')
      args.append(string_util.quote(annotation))
    rv = git_exe.call_git(root_dir, args)
    if push:
      clazz.push_tag(root_dir, tag)
Пример #2
0
 def test_install_python_39(self):
     tester = pip_installer_tester(python_testing._PYTHONS.PYTHON_39,
                                   'test',
                                   debug=self.DEBUG)
     self.assertFalse(path.exists(tester.installer.pip_exe))
     tester.installer.install('latest', False)
     self.assertTrue(path.exists(tester.installer.pip_exe))
     self.assertEqual(
         1,
         software_version.compare(tester.installer.pip_version(), '19.0.0'))
Пример #3
0
 def list_remote_tags_lt(self, tag, sort_type = None, reverse = False, limit = None, prefix = None):
   'List tags lesser than tag'
   tags = self.list_remote_tags(sort_type = sort_type, reverse = reverse, limit = limit, prefix = prefix)
   return git_tag_list([ t for t in tags if software_version.compare(t.name, tag) < 0 ])
Пример #4
0
 def list_remote_tags_ge(self, tag, sort_type = None, reverse = False, limit = None, prefix = None):
   'List tags greater or equal to tag'
   tags = self.list_remote_tags(sort_type = sort_type, reverse = reverse, limit = limit, prefix = prefix)
   return git_tag_list([ t for t in tags if software_version.compare(t.name, tag) >= 0 ])
Пример #5
0
 def list_local_tags_gt(self, tag, sort_type = None, reverse = False, limit = None, prefix = None):
   'List tags greater than tag'
   tags = self.list_local_tags(sort_type = sort_type, reverse = reverse, limit = limit, prefix = prefix)
   return git_tag_list([ t for t in tags if software_version.compare(t.name, tag) > 0 ])
Пример #6
0
    def test_compare(self):
        self.assertEqual(-1, VC.compare('1.2.3', '1.2.4'))
        self.assertEqual(0, VC.compare('1.2.3', '1.2.3'))
        self.assertEqual(1, VC.compare('1.2.4', '1.2.3'))
        self.assertEqual(-1, VC.compare('1.2.8', '1.2.9'))
        self.assertEqual(-1, VC.compare('1.2.10', '1.2.11'))
        self.assertEqual(-1, VC.compare('1.2.9', '1.2.10'))
        self.assertEqual(-1, VC.compare('3.0.4', '3.3'))

        self.assertEqual(1, VC.compare('1:1.2.3', '1.2.4'))
        self.assertEqual(-1, VC.compare('0:1.2.3', '1.2.4'))
        self.assertEqual(-1, VC.compare('0:1.2.3', '0:1.2.3-1'))
        self.assertEqual(1, VC.compare('0:1.2.3-3', '0:1.2.3-2'))

        self.assertEqual(1, VC.compare('1.2.3', '1.2-3'))
        self.assertEqual(-1, VC.compare('1.2-3', '1.2.3'))