Skip to content

Commit

Permalink
fix catkin_prepare_release (fix #386)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Mar 13, 2013
1 parent cda60bd commit 041f6fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions bin/catkin_prepare_release
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ from catkin.package_version import bump_version
from catkin.workspace_vcs import get_repository_type, vcs_remotes


def get_commands(path, packages, vcs_type, new_version, svn_url=None):
def get_commands(path, packages, vcs_type, bump, new_version, svn_url=None):
result = []

# bump version number
script = os.path.relpath(os.path.join(os.path.dirname(__file__), 'catkin_package_version'))
cmd = '%s --bump patch %s' % (script, path)
cmd = '%s --bump %s %s' % (script, bump, path)
result.append(cmd)

# commit modified package.xml
Expand Down Expand Up @@ -78,6 +78,7 @@ def main():
commands = get_commands(path=path,
packages=packages,
vcs_type=vcs_type,
bump=args.bump,
new_version=new_version,
svn_url=url)
#print('Execute the following commands:\n')
Expand Down
12 changes: 6 additions & 6 deletions test/unit_tests/test_prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@
class CatkinPrepareReleaseTest(unittest.TestCase):

def test_get_commands(self):
commands = get_commands('foo', {}, 'git', '0.1.2', svn_url=None)
commands = get_commands('foo', {}, 'git', 'patch', '0.1.2', svn_url=None)
# command path varies depending on where tests are run
self.assertTrue(commands[0].endswith('catkin_package_version --bump patch foo'))
self.assertEqual(['git commit -m "0.1.2" ',
'git push',
'git tag 0.1.2',
'git push --tags'], commands[1:])

commands = get_commands('foo', {'pack1': 'bar'}, 'git', '0.1.2', svn_url=None)
commands = get_commands('foo', {'pack1': 'bar'}, 'git', 'patch', '0.1.2', svn_url=None)
self.assertEqual(['git commit -m "0.1.2" pack1/package.xml',
'git push',
'git tag 0.1.2',
'git push --tags'], commands[1:])

commands = get_commands('foo', {'pack1': 'bar', 'pack2': 'foo'}, 'git', '0.1.2', svn_url=None)
commands = get_commands('foo', {'pack1': 'bar', 'pack2': 'foo'}, 'git', 'patch', '0.1.2', svn_url=None)
self.assertEqual(['git commit -m "0.1.2" pack1/package.xml pack2/package.xml',
'git push',
'git tag 0.1.2',
'git push --tags'], commands[1:])

def test_get_commands_svn(self):
# command path varies depending on where tests are run
commands = get_commands('foo', {}, 'svn', '0.1.2', svn_url='http://foo.bar/project1/trunk')
commands = get_commands('foo', {}, 'svn', 'patch', '0.1.2', svn_url='http://foo.bar/project1/trunk')
self.assertTrue(commands[0].endswith('catkin_package_version --bump patch foo'))
self.assertEqual(['svn commit -m "0.1.2" ',
'svn cp -m "tagging 0.1.2" http://foo.bar/project1/trunk http://foo.bar/project1/tags/0.1.2'], commands[1:])

commands = get_commands('foo', {}, 'svn', '0.1.2', svn_url='http://foo.bar/project1/branches/branch_foo')
commands = get_commands('foo', {}, 'svn', 'patch', '0.1.2', svn_url='http://foo.bar/project1/branches/branch_foo')
self.assertEqual(['svn commit -m "0.1.2" ',
'svn cp -m "tagging 0.1.2" http://foo.bar/project1/branches/branch_foo http://foo.bar/project1/tags/0.1.2'], commands[1:])

commands = get_commands('foo', {}, 'svn', '0.1.2', svn_url='http://foo.bar/project1/tags/tag_foo')
commands = get_commands('foo', {}, 'svn', 'patch', '0.1.2', svn_url='http://foo.bar/project1/tags/tag_foo')
self.assertEqual(['svn commit -m "0.1.2" ',
'svn cp -m "tagging 0.1.2" http://foo.bar/project1/tags/tag_foo http://foo.bar/project1/tags/0.1.2'], commands[1:])

0 comments on commit 041f6fc

Please sign in to comment.