def test_submit_remove_cr(in_process, git_repo_path, init_sha):
    if environment.IS_WINDOWS:
        pytest.skip('Removing CR will not work on Windows.')
    call_conduit.side_effect = (dict(), dict(data=[dict(phid='PHID-REPO-1', fields=dict(vcs='git'))]), [dict(userName='alice', phid='PHID-USER-1')], dict(dict(phid='PHID-DIFF-1', diffid='1')), dict(), dict(object=dict(id='123')), dict(), dict(dict(phid='PHID-DIFF-2', diffid='2')), dict(), dict(object=dict(id='124')), dict())
    test_a = (git_repo_path / 'X')
    test_a.write_text('a\r\nb\n')
    git_out('add', 'X')
    git_out('commit', '-am', 'A r?alice')
    mozphab.main(['submit', '--yes', '--bug', '1', init_sha], is_development=True)
    call_conduit.reset_mock()
    test_a.write_text('a\nb\n')
    git_out('commit', '-am', 'B r?alice')
    mozphab.main(['submit', '--yes', '--bug', '1', 'HEAD~'], is_development=True)
    assert (mock.call('differential.creatediff', {'changes': [{'metadata': {}, 'oldPath': 'X', 'currentPath': 'X', 'awayPaths': [], 'oldProperties': {}, 'newProperties': {}, 'commitHash': mock.ANY, 'type': 2, 'fileType': 1, 'hunks': [{'oldOffset': 1, 'oldLength': 2, 'newOffset': 1, 'newLength': 2, 'addLines': 1, 'delLines': 1, 'isMissingOldNewline': False, 'isMissingNewNewline': False, 'corpus': '-a\r\n+a\n b\n'}]}], 'sourceMachine': 'http://example.test', 'sourceControlSystem': 'git', 'sourceControlPath': '/', 'sourceControlBaseRevision': mock.ANY, 'creationMethod': 'moz-phab-git', 'lintStatus': 'none', 'unitStatus': 'none', 'repositoryPHID': 'PHID-REPO-1', 'sourcePath': mock.ANY, 'branch': 'HEAD'}) in call_conduit.call_args_list)
    assert (mock.call('differential.setdiffproperty', {'diff_id': '2', 'name': 'local:commits', 'data': (Contains('"summary": "Bug 1 - B r?alice"') & Contains('"message": "Bug 1 - B r?alice\\n\\nSummary:\\n\\n\\n\\n\\nTest Plan:\\n\\nReviewers: alice\\n\\nSubscribers:\\n\\nBug #: 1"'))}) in call_conduit.call_args_list)
def test_submit_remove_cr(in_process, git_repo_path, init_sha):
    if environment.IS_WINDOWS:
        pytest.skip('Removing CR will not work on Windows.')
    call_conduit.side_effect = (dict(), dict(data=[dict(phid='PHID-REPO-1', fields=dict(vcs='git'))]), [dict(userName='alice', phid='PHID-USER-1')], dict(dict(phid='PHID-DIFF-1', diffid='1')), dict(), dict(object=dict(id='123')), dict(), dict(dict(phid='PHID-DIFF-2', diffid='2')), dict(), dict(object=dict(id='124')), dict())
    test_a = (git_repo_path / 'X')
    test_a.write_text('a\r\nb\n')
    git_out('add', 'X')
    git_out('commit', '-am', 'A r?alice')
    mozphab.main(['submit', '--yes', '--bug', '1', init_sha], is_development=True)
    call_conduit.reset_mock()
    test_a.write_text('a\nb\n')
    git_out('commit', '-am', 'B r?alice')
    mozphab.main(['submit', '--yes', '--bug', '1', 'HEAD~'], is_development=True)
    assert (mock.call('differential.creatediff', {'changes': [{'metadata': {}, 'oldPath': 'X', 'currentPath': 'X', 'awayPaths': [], 'oldProperties': {}, 'newProperties': {}, 'commitHash': mock.ANY, 'type': 2, 'fileType': 1, 'hunks': [{'oldOffset': 1, 'oldLength': 2, 'newOffset': 1, 'newLength': 2, 'addLines': 1, 'delLines': 1, 'isMissingOldNewline': False, 'isMissingNewNewline': False, 'corpus': '-a\r\n+a\n b\n'}]}], 'sourceMachine': 'http://example.test', 'sourceControlSystem': 'git', 'sourceControlPath': '/', 'sourceControlBaseRevision': mock.ANY, 'creationMethod': 'moz-phab-git', 'lintStatus': 'none', 'unitStatus': 'none', 'repositoryPHID': 'PHID-REPO-1', 'sourcePath': mock.ANY, 'branch': 'HEAD'}) in call_conduit.call_args_list)
    assert (mock.call('differential.setdiffproperty', {'diff_id': '2', 'name': 'local:commits', 'data': (Contains('"summary": "Bug 1 - B r?alice"') & Contains('"message": "Bug 1 - B r?alice\\n\\nSummary:\\n\\n\\n\\n\\nTest Plan:\\n\\nReviewers: alice\\n\\nSubscribers:\\n\\nBug #: 1"'))}) in call_conduit.call_args_list)