{"action":"created","comment":{"url":"https://api.github.com/repos/fragglet/agito/pulls/comments/56663268","id":56663268,"diff_hunk":"@@ -607,6 +607,37 @@ def append_branch_info(path, entry, message):\n \t     + (\"Subversion-branch: %s\\n\" % str(path)) \\\n \t     + (\"Subversion-revision: %i\\n\" % entry.revision.number)\n \n+def rewrite_commit_refs(path, entry, message):\n+\t\"\"\"Rewrites Subversion commit references to Git commits.\n+\n+\tSupports `r123` and ``[123]`` style commits\n+\n+\tArgs:\n+\t  path: Path of the branch within Subversion.\n+\t  entry: Log entry with the details of this commit.\n+\t  message: The commit message text.\n+\tReturns:\n+\t  Altered commit message text with commit references replaced.\n+\t\"\"\"\n+\tdef substitute(m):\n+\t\tref = m.group(1)\n+\t\tcommit = get_commit(path, ref)\n+\n+\t\tif commit is None:\n+\t\t\tprint(\"No commit matches %r\" % ref)\n+\t\t\treturn m.group(0) # no replacement\n+\t\telif commit:\n+\t\t\t# truncate hash to 8 chars\n+\t\t\treturn commit[0:8]\n+\t\telse:\n+\t\t\tprint(\"Cannot resolve %r\" % ref)\n+\t\t\treturn m.group(0) # no replacement\n+\n+\tfor regexp in (r\"r([0-9.]+)\", r\"\\[([0-9]+)\\]\"):\n+\t\tmessage = re.compile(regexp).sub(lambda m: substitute(m), message)","path":"agito.py","position":31,"original_position":31,"commit_id":"486750589c312895bae45c174d9e238abab66963","original_commit_id":"486750589c312895bae45c174d9e238abab66963","user":{"login":"fragglet","id":96821,"avatar_url":"https://avatars.githubusercontent.com/u/96821?v=3","gravatar_id":"","url":"https://api.github.com/users/fragglet","html_url":"https://github.com/fragglet","followers_url":"https://api.github.com/users/fragglet/followers","following_url":"https://api.github.com/users/fragglet/following{/other_user}","gists_url":"https://api.github.com/users/fragglet/gists{/gist_id}","starred_url":"https://api.github.com/users/fragglet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fragglet/subscriptions","organizations_url":"https://api.github.com/users/fragglet/orgs","repos_url":"https://api.github.com/users/fragglet/repos","events_url":"https://api.github.com/users/fragglet/events{/privacy}","received_events_url":"https://api.github.com/users/fragglet/received_events","type":"User","site_admin":false},"body":"The lambda is useless here; just 'substitute' will do.","created_at":"2016-03-18T14:25:45Z","updated_at":"2016-03-18T14:25:45Z","html_url":"https://github.com/fragglet/agito/pull/6#discussion_r56663268","pull_request_url":"https://api.github.com/repos/fragglet/agito/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/fragglet/agito/pulls/comments/56663268"},"html":{"href":"https://github.com/fragglet/agito/pull/6#discussion_r56663268"},"pull_request":{"href":"https://api.github.com/repos/fragglet/agito/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/fragglet/agito/pulls/6","id":63373104,"html_url":"https://github.com/fragglet/agito/pull/6","diff_url":"https://github.com/fragglet/agito/pull/6.diff","patch_url":"https://github.com/fragglet/agito/pull/6.patch","issue_url":"https://api.github.com/repos/fragglet/agito/issues/6","number":6,"state":"open","locked":false,"title":"add rewrite_commit_refs","user":{"login":"glensc","id":199095,"avatar_url":"https://avatars.githubusercontent.com/u/199095?v=3","gravatar_id":"","url":"https://api.github.com/users/glensc","html_url":"https://github.com/glensc","followers_url":"https://api.github.com/users/glensc/followers","following_url":"https://api.github.com/users/glensc/following{/other_user}","gists_url":"https://api.github.com/users/glensc/gists{/gist_id}","starred_url":"https://api.github.com/users/glensc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glensc/subscriptions","organizations_url":"https://api.github.com/users/glensc/orgs","repos_url":"https://api.github.com/users/glensc/repos","events_url":"https://api.github.com/users/glensc/events{/privacy}","received_events_url":"https://api.github.com/users/glensc/received_events","type":"User","site_admin":false},"body":"add rewrite_commit_refs, see #4","created_at":"2016-03-18T13:22:26Z","updated_at":"2016-03-18T14:25:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b4e940bd7b734c536b1746e4e39fb9705cc9e8b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fragglet/agito/pulls/6/commits","review_comments_url":"https://api.github.com/repos/fragglet/agito/pulls/6/comments","review_comment_url":"https://api.github.com/repos/fragglet/agito/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fragglet/agito/issues/6/comments","statuses_url":"https://api.github.com/repos/fragglet/agito/statuses/486750589c312895bae45c174d9e238abab66963","head":{"label":"glensc:rewrite_commit_refs","ref":"rewrite_commit_refs","sha":"486750589c312895bae45c174d9e238abab66963","user":{"login":"glensc","id":199095,"avatar_url":"https://avatars.githubusercontent.com/u/199095?v=3","gravatar_id":"","url":"https://api.github.com/users/glensc","html_url":"https://github.com/glensc","followers_url":"https://api.github.com/users/glensc/followers","following_url":"https://api.github.com/users/glensc/following{/other_user}","gists_url":"https://api.github.com/users/glensc/gists{/gist_id}","starred_url":"https://api.github.com/users/glensc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glensc/subscriptions","organizations_url":"https://api.github.com/users/glensc/orgs","repos_url":"https://api.github.com/users/glensc/repos","events_url":"https://api.github.com/users/glensc/events{/privacy}","received_events_url":"https://api.github.com/users/glensc/received_events","type":"User","site_admin":false},"repo":{"id":54145498,"name":"agito","full_name":"glensc/agito","owner":{"login":"glensc","id":199095,"avatar_url":"https://avatars.githubusercontent.com/u/199095?v=3","gravatar_id":"","url":"https://api.github.com/users/glensc","html_url":"https://github.com/glensc","followers_url":"https://api.github.com/users/glensc/followers","following_url":"https://api.github.com/users/glensc/following{/other_user}","gists_url":"https://api.github.com/users/glensc/gists{/gist_id}","starred_url":"https://api.github.com/users/glensc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glensc/subscriptions","organizations_url":"https://api.github.com/users/glensc/orgs","repos_url":"https://api.github.com/users/glensc/repos","events_url":"https://api.github.com/users/glensc/events{/privacy}","received_events_url":"https://api.github.com/users/glensc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glensc/agito","description":"Subversion to Git conversion script","fork":true,"url":"https://api.github.com/repos/glensc/agito","forks_url":"https://api.github.com/repos/glensc/agito/forks","keys_url":"https://api.github.com/repos/glensc/agito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glensc/agito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glensc/agito/teams","hooks_url":"https://api.github.com/repos/glensc/agito/hooks","issue_events_url":"https://api.github.com/repos/glensc/agito/issues/events{/number}","events_url":"https://api.github.com/repos/glensc/agito/events","assignees_url":"https://api.github.com/repos/glensc/agito/assignees{/user}","branches_url":"https://api.github.com/repos/glensc/agito/branches{/branch}","tags_url":"https://api.github.com/repos/glensc/agito/tags","blobs_url":"https://api.github.com/repos/glensc/agito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glensc/agito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glensc/agito/git/refs{/sha}","trees_url":"https://api.github.com/repos/glensc/agito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glensc/agito/statuses/{sha}","languages_url":"https://api.github.com/repos/glensc/agito/languages","stargazers_url":"https://api.github.com/repos/glensc/agito/stargazers","contributors_url":"https://api.github.com/repos/glensc/agito/contributors","subscribers_url":"https://api.github.com/repos/glensc/agito/subscribers","subscription_url":"https://api.github.com/repos/glensc/agito/subscription","commits_url":"https://api.github.com/repos/glensc/agito/commits{/sha}","git_commits_url":"https://api.github.com/repos/glensc/agito/git/commits{/sha}","comments_url":"https://api.github.com/repos/glensc/agito/comments{/number}","issue_comment_url":"https://api.github.com/repos/glensc/agito/issues/comments{/number}","contents_url":"https://api.github.com/repos/glensc/agito/contents/{+path}","compare_url":"https://api.github.com/repos/glensc/agito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glensc/agito/merges","archive_url":"https://api.github.com/repos/glensc/agito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glensc/agito/downloads","issues_url":"https://api.github.com/repos/glensc/agito/issues{/number}","pulls_url":"https://api.github.com/repos/glensc/agito/pulls{/number}","milestones_url":"https://api.github.com/repos/glensc/agito/milestones{/number}","notifications_url":"https://api.github.com/repos/glensc/agito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glensc/agito/labels{/name}","releases_url":"https://api.github.com/repos/glensc/agito/releases{/id}","deployments_url":"https://api.github.com/repos/glensc/agito/deployments","created_at":"2016-03-17T19:24:32Z","updated_at":"2016-03-17T19:24:33Z","pushed_at":"2016-03-17T20:49:30Z","git_url":"git://github.com/glensc/agito.git","ssh_url":"git@github.com:glensc/agito.git","clone_url":"https://github.com/glensc/agito.git","svn_url":"https://github.com/glensc/agito","homepage":null,"size":45,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fragglet:master","ref":"master","sha":"c67c1c11a42ba907db725f3982bd4a03d3f45c6d","user":{"login":"fragglet","id":96821,"avatar_url":"https://avatars.githubusercontent.com/u/96821?v=3","gravatar_id":"","url":"https://api.github.com/users/fragglet","html_url":"https://github.com/fragglet","followers_url":"https://api.github.com/users/fragglet/followers","following_url":"https://api.github.com/users/fragglet/following{/other_user}","gists_url":"https://api.github.com/users/fragglet/gists{/gist_id}","starred_url":"https://api.github.com/users/fragglet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fragglet/subscriptions","organizations_url":"https://api.github.com/users/fragglet/orgs","repos_url":"https://api.github.com/users/fragglet/repos","events_url":"https://api.github.com/users/fragglet/events{/privacy}","received_events_url":"https://api.github.com/users/fragglet/received_events","type":"User","site_admin":false},"repo":{"id":6098211,"name":"agito","full_name":"fragglet/agito","owner":{"login":"fragglet","id":96821,"avatar_url":"https://avatars.githubusercontent.com/u/96821?v=3","gravatar_id":"","url":"https://api.github.com/users/fragglet","html_url":"https://github.com/fragglet","followers_url":"https://api.github.com/users/fragglet/followers","following_url":"https://api.github.com/users/fragglet/following{/other_user}","gists_url":"https://api.github.com/users/fragglet/gists{/gist_id}","starred_url":"https://api.github.com/users/fragglet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fragglet/subscriptions","organizations_url":"https://api.github.com/users/fragglet/orgs","repos_url":"https://api.github.com/users/fragglet/repos","events_url":"https://api.github.com/users/fragglet/events{/privacy}","received_events_url":"https://api.github.com/users/fragglet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fragglet/agito","description":"Subversion to Git conversion script","fork":false,"url":"https://api.github.com/repos/fragglet/agito","forks_url":"https://api.github.com/repos/fragglet/agito/forks","keys_url":"https://api.github.com/repos/fragglet/agito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fragglet/agito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fragglet/agito/teams","hooks_url":"https://api.github.com/repos/fragglet/agito/hooks","issue_events_url":"https://api.github.com/repos/fragglet/agito/issues/events{/number}","events_url":"https://api.github.com/repos/fragglet/agito/events","assignees_url":"https://api.github.com/repos/fragglet/agito/assignees{/user}","branches_url":"https://api.github.com/repos/fragglet/agito/branches{/branch}","tags_url":"https://api.github.com/repos/fragglet/agito/tags","blobs_url":"https://api.github.com/repos/fragglet/agito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fragglet/agito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fragglet/agito/git/refs{/sha}","trees_url":"https://api.github.com/repos/fragglet/agito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fragglet/agito/statuses/{sha}","languages_url":"https://api.github.com/repos/fragglet/agito/languages","stargazers_url":"https://api.github.com/repos/fragglet/agito/stargazers","contributors_url":"https://api.github.com/repos/fragglet/agito/contributors","subscribers_url":"https://api.github.com/repos/fragglet/agito/subscribers","subscription_url":"https://api.github.com/repos/fragglet/agito/subscription","commits_url":"https://api.github.com/repos/fragglet/agito/commits{/sha}","git_commits_url":"https://api.github.com/repos/fragglet/agito/git/commits{/sha}","comments_url":"https://api.github.com/repos/fragglet/agito/comments{/number}","issue_comment_url":"https://api.github.com/repos/fragglet/agito/issues/comments{/number}","contents_url":"https://api.github.com/repos/fragglet/agito/contents/{+path}","compare_url":"https://api.github.com/repos/fragglet/agito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fragglet/agito/merges","archive_url":"https://api.github.com/repos/fragglet/agito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fragglet/agito/downloads","issues_url":"https://api.github.com/repos/fragglet/agito/issues{/number}","pulls_url":"https://api.github.com/repos/fragglet/agito/pulls{/number}","milestones_url":"https://api.github.com/repos/fragglet/agito/milestones{/number}","notifications_url":"https://api.github.com/repos/fragglet/agito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fragglet/agito/labels{/name}","releases_url":"https://api.github.com/repos/fragglet/agito/releases{/id}","deployments_url":"https://api.github.com/repos/fragglet/agito/deployments","created_at":"2012-10-05T23:50:47Z","updated_at":"2016-03-14T16:35:16Z","pushed_at":"2016-03-18T13:22:27Z","git_url":"git://github.com/fragglet/agito.git","ssh_url":"git@github.com:fragglet/agito.git","clone_url":"https://github.com/fragglet/agito.git","svn_url":"https://github.com/fragglet/agito","homepage":null,"size":176,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fragglet/agito/pulls/6"},"html":{"href":"https://github.com/fragglet/agito/pull/6"},"issue":{"href":"https://api.github.com/repos/fragglet/agito/issues/6"},"comments":{"href":"https://api.github.com/repos/fragglet/agito/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/fragglet/agito/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/fragglet/agito/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fragglet/agito/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/fragglet/agito/statuses/486750589c312895bae45c174d9e238abab66963"}}}}