示例#1
0
    def test_should_use_first_argument_as_commit_message_when_committing(self, mock_discover):
        mock_vcs_client = self.create_mock_vcs_client()
        mock_discover.return_value = mock_vcs_client

        commit(['/usr/local/bin/commit', 'This is the message'])

        self.assertEqual(call('This is the message'), mock_vcs_client.commit.call_args)
示例#2
0
    def test_should_detect_vcs_client(self, mock_detect):
        mock_vcs_client = self.create_mock_vcs_client()
        mock_detect.return_value = mock_vcs_client

        commit(['/usr/local/bin/commit', 'This is the message'])

        self.assertEqual(call(), mock_detect.call_args)
示例#3
0
    def test_should_exit_with_error_when_found_changes(self, mock_discover, mock_logger, mock_exit):
        mock_vcs_client = self.create_mock_vcs_client()
        mock_vcs_client.everything_was_up_to_date = False
        mock_discover.return_value = mock_vcs_client

        commit(['/usr/local/bin/commit', 'This is the message'])

        self.assertEqual(call(1), mock_exit.call_args)
示例#4
0
    def test_should_print_error_message_when_found_changes(self, mock_discover, mock_logger, mock_exit):
        mock_vcs_client = self.create_mock_vcs_client()
        mock_vcs_client.everything_was_up_to_date = False
        mock_discover.return_value = mock_vcs_client

        commit(['/usr/local/bin/commit', 'This is the message'])

        self.assertEqual(call('Commit interrupted: unexpected "update" result or "update" found changes.'), mock_logger.error.call_args)
示例#5
0
    def test_should_commit_when_no_changes_found(self, mock_discover, mock_logger):
        mock_vcs_client = self.create_mock_vcs_client()
        mock_vcs_client.everything_was_up_to_date = True
        mock_discover.return_value = mock_vcs_client

        commit(['/usr/local/bin/commit', 'This is the message'])

        self.assertEqual(call('This is the message'), mock_vcs_client.commit.call_args)
示例#6
0
def commit_changes(arguments, configuration):

    if configuration.execute_before_commit:
        command_and_arguments = configuration.execute_before_commit.split()
        execute_command(command_and_arguments[0], *command_and_arguments[1:])

    commit(arguments)

    if configuration.motivate_me:
        execute_motivation_command(configuration)
示例#7
0
def commit_changes(arguments, configuration=None):
    if configuration.execute_before_commit:
        command_and_arguments = configuration.execute_before_commit.split()
        execute_command(command_and_arguments[0], *command_and_arguments[1:])

    commit(arguments)
示例#8
0
def commit_changes(arguments):
    commit(arguments)
def commit_changes(arguments, configuration=None):
    if configuration.execute_before_commit:
        command_and_arguments = configuration.execute_before_commit.split()
        execute_command(command_and_arguments[0], *command_and_arguments[1:])

    commit(arguments)