GitHub PullRequestReviewCommentEvent at 2014-06-25 11:14:29
Repository: yast-packager
Actor: jreidinger
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/yast/yast-packager/pulls/comments/14179767","id":14179767,"diff_hunk":"@@ -651,10 +661,157 @@ def Summary(flags, use_cache)\n       deep_copy(ret)\n     end\n \n+    # group products according to the current state\n+    # @param [Array<Hash>] products list of products (returned by Pkg.ResolvableProperties call)\n+    # @return [Hash<Symbol,Object>] grouped products\n+    #   the keys are :new, :removed, :kept, :updated\n+    #   For each key the value is a list of products, except for :updated\n+    #   key which contains a Hash with old_product => new_product mapping\n+    def group_products_by_status(products)\n+      # list of all products that will be installed (are selected)\n+      installed_products = products.select do |product|\n+        product[\"status\"] == :selected\n+      end\n+\n+      # list of all products that will be removed\n+      removed_products = products.select do |product|\n+        product[\"status\"] == :removed\n+      end\n+\n+      # process the selected and removed products and find product upgrades\n+      # map content: old_product => new_product\n+      upgraded_products = {}\n+      installed_products.each do |installed_product|\n+        removed = removed_products.find do |removed_product|\n+          installed_name = installed_product[\"name\"]\n+          removed_name = removed_product[\"name\"]\n+\n+          # check the current product names or product renames\n+          removed_name == installed_name || (PRODUCT_RENAMES.has_key?(removed_name) &&\n+            PRODUCT_RENAMES[removed_name] == installed_name)\n+        end\n+\n+        upgraded_products[removed] = installed_product if removed\n+      end\n+\n+      # remove the upgraded products from selected and removed lists\n+      removed_products -= upgraded_products.keys\n+      installed_products -= upgraded_products.values\n+\n+      # list of all products that will be unchanged (kept installed)\n+      kept_products = products.select do |product|\n+        product[\"status\"] == :installed\n+      end\n+\n+      ret = {\n+        :new => installed_products,\n+        :removed => removed_products,\n+        :kept => kept_products,\n+        :updated => upgraded_products\n+      }\n+\n+      log.info \"Product upgrade status: #{ret}\"\n+\n+      ret\n+    end\n+\n+    # create a product update summary (in rich text format)\n+    # usable in update proposal\n+    # @see #product_update_warning how to set and display possible issues\n+    # @param [Array<Hash>] products list of products (returned by Pkg.ResolvableProperties call)\n+    # @return [Array<String>] list of rich text descriptions\n+    def product_update_summary(products)\n+      status = group_products_by_status(products)\n+\n+      ret = []\n+\n+      # newly installed products\n+      status[:new].each do |product|\n+        log.info \"New product will be installed: #{product}\"\n+        ret << _(\"New product <b>%s</b> will be installed\") % h(product_label(product))\n+      end\n+\n+      status[:updated].each do |removed, installed|","path":"src/modules/Packages.rb","position":102,"original_position":102,"commit_id":"cd3866207fafa87118d233a10325759769c85414","original_commit_id":"cd3866207fafa87118d233a10325759769c85414","user":{"login":"jreidinger","id":478871,"avatar_url":"https://avatars.githubusercontent.com/u/478871?","gravatar_id":"f9a9cf77af20d925b328ee8c95c0068c","url":"https://api.github.com/users/jreidinger","html_url":"https://github.com/jreidinger","followers_url":"https://api.github.com/users/jreidinger/followers","following_url":"https://api.github.com/users/jreidinger/following{/other_user}","gists_url":"https://api.github.com/users/jreidinger/gists{/gist_id}","starred_url":"https://api.github.com/users/jreidinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreidinger/subscriptions","organizations_url":"https://api.github.com/users/jreidinger/orgs","repos_url":"https://api.github.com/users/jreidinger/repos","events_url":"https://api.github.com/users/jreidinger/events{/privacy}","received_events_url":"https://api.github.com/users/jreidinger/received_events","type":"User","site_admin":false},"body":"it is nice, that you can use same reduce here\r\nret = status[:new].reduce(ret) do |res, product|","created_at":"2014-06-25T11:14:29Z","updated_at":"2014-06-25T11:14:29Z","html_url":"https://github.com/yast/yast-packager/pull/59#discussion_r14179767","pull_request_url":"https://api.github.com/repos/yast/yast-packager/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/comments/14179767"},"html":{"href":"https://github.com/yast/yast-packager/pull/59#discussion_r14179767"},"pull_request":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/yast/yast-packager/pulls/59","id":17582959,"html_url":"https://github.com/yast/yast-packager/pull/59","diff_url":"https://github.com/yast/yast-packager/pull/59.diff","patch_url":"https://github.com/yast/yast-packager/pull/59.patch","issue_url":"https://api.github.com/repos/yast/yast-packager/issues/59","number":59,"state":"open","title":"Packages.rb - added product upgrade summary functions (bnc#883047)","user":{"login":"lslezak","id":907998,"avatar_url":"https://avatars.githubusercontent.com/u/907998?","gravatar_id":"654c5b4f0d657240edff9440a901839b","url":"https://api.github.com/users/lslezak","html_url":"https://github.com/lslezak","followers_url":"https://api.github.com/users/lslezak/followers","following_url":"https://api.github.com/users/lslezak/following{/other_user}","gists_url":"https://api.github.com/users/lslezak/gists{/gist_id}","starred_url":"https://api.github.com/users/lslezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lslezak/subscriptions","organizations_url":"https://api.github.com/users/lslezak/orgs","repos_url":"https://api.github.com/users/lslezak/repos","events_url":"https://api.github.com/users/lslezak/events{/privacy}","received_events_url":"https://api.github.com/users/lslezak/received_events","type":"User","site_admin":false},"body":"- 3.1.24\r\n\r\n(Note: the methods will be used in `yast2-update`.)","created_at":"2014-06-25T10:44:13Z","updated_at":"2014-06-25T11:14:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44f6fbae2f98818c7cf266075ac07b64d8d7acc8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yast/yast-packager/pulls/59/commits","review_comments_url":"https://api.github.com/repos/yast/yast-packager/pulls/59/comments","review_comment_url":"https://api.github.com/repos/yast/yast-packager/pulls/comments/{number}","comments_url":"https://api.github.com/repos/yast/yast-packager/issues/59/comments","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/cd3866207fafa87118d233a10325759769c85414","head":{"label":"yast:product_check_bnc883047","ref":"product_check_bnc883047","sha":"cd3866207fafa87118d233a10325759769c85414","user":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?","gravatar_id":"e467a14202136d0b384e7b8ce386d6d5","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368179,"name":"yast-packager","full_name":"yast/yast-packager","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?","gravatar_id":"e467a14202136d0b384e7b8ce386d6d5","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-packager","description":"YaST module packager","fork":false,"url":"https://api.github.com/repos/yast/yast-packager","forks_url":"https://api.github.com/repos/yast/yast-packager/forks","keys_url":"https://api.github.com/repos/yast/yast-packager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-packager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-packager/teams","hooks_url":"https://api.github.com/repos/yast/yast-packager/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-packager/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-packager/events","assignees_url":"https://api.github.com/repos/yast/yast-packager/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-packager/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-packager/tags","blobs_url":"https://api.github.com/repos/yast/yast-packager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-packager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-packager/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-packager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-packager/languages","stargazers_url":"https://api.github.com/repos/yast/yast-packager/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-packager/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-packager/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-packager/subscription","commits_url":"https://api.github.com/repos/yast/yast-packager/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-packager/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-packager/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-packager/issues/comments/{number}","contents_url":"https://api.github.com/repos/yast/yast-packager/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-packager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-packager/merges","archive_url":"https://api.github.com/repos/yast/yast-packager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-packager/downloads","issues_url":"https://api.github.com/repos/yast/yast-packager/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-packager/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-packager/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-packager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-packager/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-packager/releases{/id}","created_at":"2012-05-18T10:25:23Z","updated_at":"2014-06-24T19:26:35Z","pushed_at":"2014-06-25T10:41:54Z","git_url":"git://github.com/yast/yast-packager.git","ssh_url":"git@github.com:yast/yast-packager.git","clone_url":"https://github.com/yast/yast-packager.git","svn_url":"https://github.com/yast/yast-packager","homepage":"http://en.opensuse.org/Portal:YaST","size":36454,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"yast:master","ref":"master","sha":"b4428988ec5149f0f6ad9df5241423736a752752","user":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?","gravatar_id":"e467a14202136d0b384e7b8ce386d6d5","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368179,"name":"yast-packager","full_name":"yast/yast-packager","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?","gravatar_id":"e467a14202136d0b384e7b8ce386d6d5","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-packager","description":"YaST module packager","fork":false,"url":"https://api.github.com/repos/yast/yast-packager","forks_url":"https://api.github.com/repos/yast/yast-packager/forks","keys_url":"https://api.github.com/repos/yast/yast-packager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-packager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-packager/teams","hooks_url":"https://api.github.com/repos/yast/yast-packager/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-packager/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-packager/events","assignees_url":"https://api.github.com/repos/yast/yast-packager/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-packager/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-packager/tags","blobs_url":"https://api.github.com/repos/yast/yast-packager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-packager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-packager/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-packager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-packager/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-packager/languages","stargazers_url":"https://api.github.com/repos/yast/yast-packager/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-packager/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-packager/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-packager/subscription","commits_url":"https://api.github.com/repos/yast/yast-packager/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-packager/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-packager/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-packager/issues/comments/{number}","contents_url":"https://api.github.com/repos/yast/yast-packager/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-packager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-packager/merges","archive_url":"https://api.github.com/repos/yast/yast-packager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-packager/downloads","issues_url":"https://api.github.com/repos/yast/yast-packager/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-packager/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-packager/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-packager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-packager/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-packager/releases{/id}","created_at":"2012-05-18T10:25:23Z","updated_at":"2014-06-24T19:26:35Z","pushed_at":"2014-06-25T10:41:54Z","git_url":"git://github.com/yast/yast-packager.git","ssh_url":"git@github.com:yast/yast-packager.git","clone_url":"https://github.com/yast/yast-packager.git","svn_url":"https://github.com/yast/yast-packager","homepage":"http://en.opensuse.org/Portal:YaST","size":36454,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/59"},"html":{"href":"https://github.com/yast/yast-packager/pull/59"},"issue":{"href":"https://api.github.com/repos/yast/yast-packager/issues/59"},"comments":{"href":"https://api.github.com/repos/yast/yast-packager/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/yast/yast-packager/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/yast/yast-packager/statuses/cd3866207fafa87118d233a10325759769c85414"}}}}