# Path: ghtools/exceptions.py
# class GithubAPIError(GithubError):
#     pass
# 
# Path: ghtools/migrators/issues.py
# def _get_author(client, login, _author_memo={}):
#     if login not in _author_memo:
#         _author_memo[login] = client.get('/users/{0}'.format(login)).json()
#     return _author_memo[login]


import logging
import textwrap
from ghtools.exceptions import GithubAPIError
from ghtools.migrators.issues import _get_author


log = logging.getLogger(__name__)


def migrate(src, dst):
    log.info("Migrating %s to %s -> commit comments", src, dst)

    for comment in src.list_commit_comments():
        body = _generate_comment_body(src.client, comment)

        payload = {
            'body': body,
            'path': comment['path'],
            'position': comment['position'],
            'line': comment['line']
        }

        try:
            dst.create_commit_comment(comment['commit_id'], payload)

# Path: ghtools/exceptions.py
# class GithubAPIError(GithubError):
#     pass
# 
# Path: ghtools/migrators/issues.py
# def _get_author(client, login, _author_memo={}):
#     if login not in _author_memo:
#         _author_memo[login] = client.get('/users/{0}'.format(login)).json()
#     return _author_memo[login]


# Path: ghtools/migrators/comments.py
import logging
import textwrap
from ghtools.exceptions import GithubAPIError
from ghtools.migrators.issues import _get_author



log = logging.getLogger(__name__)


def migrate(src, dst):
    log.info("Migrating %s to %s -> commit comments", src, dst)

    for comment in src.list_commit_comments():
        body = _generate_comment_body(src.client, comment)

        payload = {
            'body': body,
            'path': comment['path'],
            'position': comment['position'],
            'line': comment['line']
        }

        try:
            dst.create_commit_comment(comment['commit_id'], payload)

        except GithubAPIError as e: