示例#1
0
 def test_saves_additional_history(self):
     history = {'version': '0.0.2', 'history': ['0.0.1']}
     build.update_version(history, '0.0.3')
     self.assertEquals(history.get('version'), '0.0.3')
     self.assertEquals(len(history.get('history')), 2)
     self.assertEquals(history.get('history')[0], '0.0.1')
     self.assertEquals(history.get('history')[1], '0.0.2')
	def test_saves_additional_history(self):
		history = { 'version': '0.0.2', 'history': [ '0.0.1' ] }
		build.update_version(history, '0.0.3')
		self.assertEquals(history.get('version'), '0.0.3')
		self.assertEquals(len(history.get('history')), 2)
		self.assertEquals(history.get('history')[0], '0.0.1')
		self.assertEquals(history.get('history')[1], '0.0.2')
示例#3
0
 def test_default_version_update(self):
     self.assertEquals(build.update_version({'version': '1.2.3'}, None),
                       '1.2.4')
示例#4
0
 def test_initial_version(self):
     self.assertEquals(build.update_version({}, None), '0.0.1')
	def test_initial_version(self):
		self.assertEquals(build.update_version({}, None), '0.0.1')
示例#6
0
 def test_saves_initial_history(self):
     history = {'version': '0.0.1'}
     build.update_version(history, '0.0.2')
     self.assertEquals(history.get('version'), '0.0.2')
     self.assertEquals(len(history.get('history')), 1)
     self.assertEquals(history.get('history')[0], '0.0.1')
示例#7
0
 def test_illegal_new_version_update(self):
     with self.assertRaises(SystemExit):
         with capture_output() as (out, err):
             build.update_version({'version': '1.2.3'}, 'nonsense')
     self.assertIn('Argument must specify', err.getvalue())
示例#8
0
 def test_explicit_version_update(self):
     self.assertEquals(build.update_version({'version': '1.2.3'}, '5.0.1'),
                       '5.0.1')
	def test_illegal_old_version_update(self):
		with self.assertRaises(SystemExit):
			with capture_output() as (out,err):
				build.update_version({ 'version': 'nonsense' }, 'patch')
		self.assertIn('prior version must be in semver format', err.getvalue())
	def test_annotated_version_update(self):
		self.assertEquals(build.update_version({ 'version': '1.2.3-alpha.1' }, '1.2.4'), '1.2.4')
	def test_explicit_version_update(self):
		self.assertEquals(build.update_version({ 'version': '1.2.3' }, '5.0.1'), '5.0.1')
	def test_major_version_update(self):
		self.assertEquals(build.update_version({ 'version': '1.2.3' }, 'major'), '2.0.0')
	def test_patch_version_update(self):
		self.assertEquals(build.update_version({ 'version': '1.2.3' }, 'patch'), '1.2.4')
	def test_default_version_update(self):
		self.assertEquals(build.update_version({ 'version': '1.2.3' }, None), '1.2.4')
示例#15
0
 def test_patch_version_update(self):
     self.assertEquals(build.update_version({'version': '1.2.3'}, 'patch'),
                       '1.2.4')
示例#16
0
 def test_major_version_update(self):
     self.assertEquals(build.update_version({'version': '1.2.3'}, 'major'),
                       '2.0.0')
	def test_illegal_new_version_update(self):
		with self.assertRaises(SystemExit):
			with capture_output() as (out,err):
				build.update_version({ 'version': '1.2.3' }, 'nonsense')
		self.assertIn('Argument must specify', err.getvalue())
示例#18
0
 def test_illegal_old_version_update(self):
     with self.assertRaises(SystemExit):
         with capture_output() as (out, err):
             build.update_version({'version': 'nonsense'}, 'patch')
     self.assertIn('Version must be in semver format', err.getvalue())
	def test_illegal_annotated_version_update(self):
		with self.assertRaises(SystemExit):
			with capture_output() as (out,err):
				build.update_version({ 'version': '1.2.3-alpha.1' }, None)
		self.assertIn('The prior version was 1.2.3-alpha.1', err.getvalue())
		self.assertIn('and must not include a label', err.getvalue())
示例#20
0
 def test_saves_initial_version(self):
     history = {}
     build.update_version(history, '0.0.1')
     self.assertEquals(history.get('version'), '0.0.1')
     self.assertEquals(len(history.get('history', [])), 0)
	def test_saves_initial_version(self):
		history = {}
		build.update_version(history, '0.0.1')
		self.assertEquals(history.get('version'), '0.0.1')
		self.assertEquals(len(history.get('history', [])), 0)
	def test_saves_initial_history(self):
		history = { 'version': '0.0.1' }
		build.update_version(history, '0.0.2')
		self.assertEquals(history.get('version'), '0.0.2')
		self.assertEquals(len(history.get('history')), 1)
		self.assertEquals(history.get('history')[0], '0.0.1')
示例#23
0
    if res == 'yes':

        call('git commit -a -m "bumps to version %s"' % conanfile.version)
        call('git tag v{0} -m "bumps to version {0}"'.format(
            conanfile.version))
        m.success('version %s has been bumped.' % conanfile.version)
        m.info('''
        Now we will push the commit to remote
        ''')
        os.system('git push')
        m.info('''
        Now we will push the commit and tags to remote
        ''')
        os.system('git push --tags')

        m.warn('DO NOT forget change the branch to dev version.')

    else:
        for filename in files:
            call('git checkout -- %s' % filename)
        m.warn('version bump canceled, all changed file reverted.')


if __name__ == '__main__':

    if check():
        version = hint()
        if version:
            files = update_version(version)
            confirm(files)