{"action":"created","comment":{"url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/comments/64005096","id":64005096,"diff_hunk":"@@ -727,33 +727,41 @@ def write_changes(changes_filename, changes, version, author):\n     shutil.move(tmp_fp.name, changes_filename)\n \n \n-def detect_changes_commands_git(repodir, changes):\n+def detect_changes_commands_git(repodir, subdir, changes):\n     \"\"\"Detect changes between GIT revisions.\"\"\"\n     last_rev = changes['revision']\n \n     if last_rev is None:\n-        last_rev = safe_run(['git', 'log', '-n1', '--pretty=format:%H',\n-                             '--skip=10'], cwd=repodir)[1]\n-    current_rev = safe_run(['git', 'log', '-n1', '--pretty=format:%H'],\n-                           cwd=repodir)[1]\n+        last_cmd = ['git', 'log', '-n1', '--pretty=format:%H', '--skip=10']\n+        if subdir:\n+            last_cmd += ['--', subdir]\n+        last_rev = safe_run(last_cmd, cwd=repodir)[1]\n+    current_cmd = ['git', 'log', '-n1', '--pretty=format:%H']\n+    if subdir:\n+        current_cmd += ['--', subdir]\n+    current_rev = safe_run(current_cmd, cwd=repodir)[1]\n \n     if last_rev == current_rev:\n         logging.debug(\"No new commits, skipping changes file generation\")\n         return\n \n-    logging.debug(\"Generating changes between %s and %s\", last_rev,\n-                  current_rev)\n+    dbg_msg = \"Generating changes between %s and %s\" % (last_rev, current_rev)\n+    if subdir:\n+        dbg_msg += \" (for subdir: %s)\" % (subdir)\n+    logging.debug(dbg_msg)\n \n-    lines = safe_run(['git', 'log',\n-                      '--reverse', '--no-merges', '--pretty=format:%s',\n-                      \"%s..%s\" % (last_rev, current_rev)], repodir)[1]\n+    cmd = ['git', 'log', '--reverse', '--no-merges', '--pretty=format:%s',\n+           \"%s..%s\" % (last_rev, current_rev)]\n+    if subdir:","path":"tar_scm.py","position":null,"original_position":39,"commit_id":"75d1d3a6a20866d805dd189f72ae700b8f96297a","original_commit_id":"0d238af97ff2db05df6ae1fb8b3a9cf4e5eeeb18","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"body":"@aspiers Done","created_at":"2016-05-20T08:19:10Z","updated_at":"2016-05-20T08:19:10Z","html_url":"https://github.com/openSUSE/obs-service-tar_scm/pull/101#discussion_r64005096","pull_request_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101","_links":{"self":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/comments/64005096"},"html":{"href":"https://github.com/openSUSE/obs-service-tar_scm/pull/101#discussion_r64005096"},"pull_request":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101"}}},"pull_request":{"url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101","id":70664311,"html_url":"https://github.com/openSUSE/obs-service-tar_scm/pull/101","diff_url":"https://github.com/openSUSE/obs-service-tar_scm/pull/101.diff","patch_url":"https://github.com/openSUSE/obs-service-tar_scm/pull/101.patch","issue_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/101","number":101,"state":"open","locked":false,"title":"Honour \"subdir\" param for changesgenerate","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"body":"When the \"subdir\" parameter is set and changes are generated,\r\nonly use changes which affect the given \"subdir\".\r\n\r\nFixes #37","created_at":"2016-05-19T09:44:46Z","updated_at":"2016-05-20T08:19:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4d823b044c3daf5776e7da85bf121d1690f9fc1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101/commits","review_comments_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101/comments","review_comment_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/101/comments","statuses_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/statuses/75d1d3a6a20866d805dd189f72ae700b8f96297a","head":{"label":"toabctl:handle-subdir-changelog","ref":"handle-subdir-changelog","sha":"75d1d3a6a20866d805dd189f72ae700b8f96297a","user":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"repo":{"id":59190979,"name":"obs-service-tar_scm","full_name":"toabctl/obs-service-tar_scm","owner":{"login":"toabctl","id":276317,"avatar_url":"https://avatars.githubusercontent.com/u/276317?v=3","gravatar_id":"","url":"https://api.github.com/users/toabctl","html_url":"https://github.com/toabctl","followers_url":"https://api.github.com/users/toabctl/followers","following_url":"https://api.github.com/users/toabctl/following{/other_user}","gists_url":"https://api.github.com/users/toabctl/gists{/gist_id}","starred_url":"https://api.github.com/users/toabctl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toabctl/subscriptions","organizations_url":"https://api.github.com/users/toabctl/orgs","repos_url":"https://api.github.com/users/toabctl/repos","events_url":"https://api.github.com/users/toabctl/events{/privacy}","received_events_url":"https://api.github.com/users/toabctl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/toabctl/obs-service-tar_scm","description":"An OBS source service: fetches SCM tarballs","fork":true,"url":"https://api.github.com/repos/toabctl/obs-service-tar_scm","forks_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/forks","keys_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/teams","hooks_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/hooks","issue_events_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/issues/events{/number}","events_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/events","assignees_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/assignees{/user}","branches_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/branches{/branch}","tags_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/tags","blobs_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/git/refs{/sha}","trees_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/statuses/{sha}","languages_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/languages","stargazers_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/stargazers","contributors_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/contributors","subscribers_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/subscribers","subscription_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/subscription","commits_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/commits{/sha}","git_commits_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/git/commits{/sha}","comments_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/comments{/number}","issue_comment_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/issues/comments{/number}","contents_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/contents/{+path}","compare_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/merges","archive_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/downloads","issues_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/issues{/number}","pulls_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/pulls{/number}","milestones_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/milestones{/number}","notifications_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/labels{/name}","releases_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/releases{/id}","deployments_url":"https://api.github.com/repos/toabctl/obs-service-tar_scm/deployments","created_at":"2016-05-19T09:04:03Z","updated_at":"2016-05-19T09:04:04Z","pushed_at":"2016-05-20T08:18:57Z","git_url":"git://github.com/toabctl/obs-service-tar_scm.git","ssh_url":"git@github.com:toabctl/obs-service-tar_scm.git","clone_url":"https://github.com/toabctl/obs-service-tar_scm.git","svn_url":"https://github.com/toabctl/obs-service-tar_scm","homepage":null,"size":249,"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":"openSUSE:master","ref":"master","sha":"d92758ceb0cf6aa38686919c3cd88a7707a9b2f9","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":6983651,"name":"obs-service-tar_scm","full_name":"openSUSE/obs-service-tar_scm","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/obs-service-tar_scm","description":"An OBS source service: fetches SCM tarballs","fork":false,"url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm","forks_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/forks","keys_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/teams","hooks_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/events","assignees_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/tags","blobs_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/languages","stargazers_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/subscription","commits_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/comments{/number}","contents_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/merges","archive_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/downloads","issues_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/releases{/id}","deployments_url":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/deployments","created_at":"2012-12-03T14:37:09Z","updated_at":"2016-02-25T21:09:35Z","pushed_at":"2016-05-20T08:18:57Z","git_url":"git://github.com/openSUSE/obs-service-tar_scm.git","ssh_url":"git@github.com:openSUSE/obs-service-tar_scm.git","clone_url":"https://github.com/openSUSE/obs-service-tar_scm.git","svn_url":"https://github.com/openSUSE/obs-service-tar_scm","homepage":null,"size":324,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":17,"forks":40,"open_issues":17,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101"},"html":{"href":"https://github.com/openSUSE/obs-service-tar_scm/pull/101"},"issue":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/101"},"comments":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/issues/101/comments"},"review_comments":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101/comments"},"review_comment":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/pulls/101/commits"},"statuses":{"href":"https://api.github.com/repos/openSUSE/obs-service-tar_scm/statuses/75d1d3a6a20866d805dd189f72ae700b8f96297a"}}}}
{"actor":{"display_login":"toabctl"}}