{"action":"created","comment":{"url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/comments/192706848","pull_request_review_id":125531087,"id":192706848,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjcwNjg0OA==","diff_hunk":"@@ -0,0 +1,344 @@\n+# encoding: utf-8\n+\n+# Copyright (c) [2018] SUSE LLC\n+#\n+# All Rights Reserved.\n+#\n+# This program is free software; you can redistribute it and/or modify it\n+# under the terms of version 2 of the GNU General Public License as published\n+# by the Free Software Foundation.\n+#\n+# This program is distributed in the hope that it will be useful, but WITHOUT\n+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n+# more details.\n+#\n+# You should have received a copy of the GNU General Public License along\n+# with this program; if not, contact SUSE LLC.\n+#\n+# To contact SUSE LLC about this file by physical or electronic mail, you may\n+# find current contact information at www.suse.com.\n+\n+require \"yast\"\n+require \"yast/i18n\"\n+require \"yast2/popup\"\n+require \"y2partitioner/dialogs/partition_move\"\n+require \"y2partitioner/device_graphs\"\n+require \"y2partitioner/ui_state\"\n+\n+module Y2Partitioner\n+  module Actions\n+    # Action for moving a partition\n+    #\n+    # To move a partition means to place it at the beginning or at the end of the\n+    # previous or next adjacent free space, respectively.\n+    class MovePartition\n+      include Yast::I18n\n+\n+      # Constructor\n+      #\n+      # @param partition [Y2Storage::BlkDevice]\n+      def initialize(partition)\n+        textdomain \"storage\"\n+\n+        @partition = partition\n+        UIState.instance.select_row(partition.sid)\n+      end\n+\n+      # Checks whether it is possible to move the partition, and if so, the action is performed.\n+      #\n+      # @note An error popup is shown when the partition cannot be moved. In case the partition\n+      #   can be moved, a dialog is presented to select whether to move forward or backward.\n+      #\n+      # @return [Symbol] :finish if the action is performed; :back or dialog result otherwise.\n+      def run\n+        return :back unless validate\n+\n+        answer = move_partition_question\n+        return answer unless answer == :ok\n+\n+        move_partition\n+        :finish\n+      end\n+\n+    private\n+\n+      # @return [Y2Storage::BlkDevice]\n+      attr_reader :partition\n+\n+      # @return [Symbol] :forward, :backward\n+      attr_reader :movement\n+\n+      # Checks whether the partition can be moved\n+      #\n+      # @note When the partition cannot be moved, it shows a popup with the reason,\n+      #   see {#error}.\n+      #\n+      # @return [Boolean] true if the partition can be moved; false otherwise.\n+      def validate\n+        return true unless error\n+\n+        Yast2::Popup.show(error, headline: :error)\n+        false\n+      end\n+\n+      # Why the partition cannot be moved\n+      #\n+      # @note A partition can be moved if is not an extended partition and it does\n+      #   not exist on disk and there is adjancent free space where to move it. In\n+      #   some cases, the move action could be called over a device that is not a\n+      #   partition (i.e., when the selected element on a table is not a partition).\n+      #   For that reason, the type of the device must be checked.\n+      #\n+      # @return [String, nil] nil when there is no error and the partition can be moved.\n+      def error\n+        device_type_error ||\n+          extended_partition_error ||\n+          existing_partition_error ||\n+          no_space_error\n+      end\n+\n+      # Error when a no partition device is tried to be moved\n+      #\n+      # @return [String, nil] nil the device is a partition\n+      def device_type_error\n+        return nil if partition.is?(:partition)\n+\n+        _(\"Hard disks, BIOS RAIDs and multipath\\n\" \\","path":"src/lib/y2partitioner/actions/move_partition.rb","position":107,"original_position":107,"commit_id":"e3b565de9114a618b225e343a4f7f2ff7d35795c","original_commit_id":"e3b565de9114a618b225e343a4f7f2ff7d35795c","user":{"login":"jreidinger","id":478871,"node_id":"MDQ6VXNlcjQ3ODg3MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/478871?v=4","gravatar_id":"","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":"this looks like a bit insuficient to the above check. Can we write only that \"Only partition can be moved.\"?","created_at":"2018-06-04T11:20:12Z","updated_at":"2018-06-04T11:20:13Z","html_url":"https://github.com/yast/yast-storage-ng/pull/652#discussion_r192706848","pull_request_url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/comments/192706848"},"html":{"href":"https://github.com/yast/yast-storage-ng/pull/652#discussion_r192706848"},"pull_request":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652"}}},"pull_request":{"url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652","id":192374887,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMzc0ODg3","html_url":"https://github.com/yast/yast-storage-ng/pull/652","diff_url":"https://github.com/yast/yast-storage-ng/pull/652.diff","patch_url":"https://github.com/yast/yast-storage-ng/pull/652.patch","issue_url":"https://api.github.com/repos/yast/yast-storage-ng/issues/652","number":652,"state":"open","locked":false,"title":"Move partitions","user":{"login":"joseivanlopez","id":1112304,"node_id":"MDQ6VXNlcjExMTIzMDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1112304?v=4","gravatar_id":"","url":"https://api.github.com/users/joseivanlopez","html_url":"https://github.com/joseivanlopez","followers_url":"https://api.github.com/users/joseivanlopez/followers","following_url":"https://api.github.com/users/joseivanlopez/following{/other_user}","gists_url":"https://api.github.com/users/joseivanlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/joseivanlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseivanlopez/subscriptions","organizations_url":"https://api.github.com/users/joseivanlopez/orgs","repos_url":"https://api.github.com/users/joseivanlopez/repos","events_url":"https://api.github.com/users/joseivanlopez/events{/privacy}","received_events_url":"https://api.github.com/users/joseivanlopez/received_events","type":"User","site_admin":false},"body":"PBI: https://trello.com/c/CwguWHoI/174-5-partitioner-plain-partitioning-move","created_at":"2018-06-04T11:15:39Z","updated_at":"2018-06-04T11:20:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0f529015c0d9de440595f22b339f960d5d12417","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652/commits","review_comments_url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652/comments","review_comment_url":"https://api.github.com/repos/yast/yast-storage-ng/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yast/yast-storage-ng/issues/652/comments","statuses_url":"https://api.github.com/repos/yast/yast-storage-ng/statuses/e3b565de9114a618b225e343a4f7f2ff7d35795c","head":{"label":"joseivanlopez:move_partitions","ref":"move_partitions","sha":"e3b565de9114a618b225e343a4f7f2ff7d35795c","user":{"login":"joseivanlopez","id":1112304,"node_id":"MDQ6VXNlcjExMTIzMDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1112304?v=4","gravatar_id":"","url":"https://api.github.com/users/joseivanlopez","html_url":"https://github.com/joseivanlopez","followers_url":"https://api.github.com/users/joseivanlopez/followers","following_url":"https://api.github.com/users/joseivanlopez/following{/other_user}","gists_url":"https://api.github.com/users/joseivanlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/joseivanlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseivanlopez/subscriptions","organizations_url":"https://api.github.com/users/joseivanlopez/orgs","repos_url":"https://api.github.com/users/joseivanlopez/repos","events_url":"https://api.github.com/users/joseivanlopez/events{/privacy}","received_events_url":"https://api.github.com/users/joseivanlopez/received_events","type":"User","site_admin":false},"repo":{"id":81220643,"node_id":"MDEwOlJlcG9zaXRvcnk4MTIyMDY0Mw==","name":"yast-storage-ng","full_name":"joseivanlopez/yast-storage-ng","owner":{"login":"joseivanlopez","id":1112304,"node_id":"MDQ6VXNlcjExMTIzMDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1112304?v=4","gravatar_id":"","url":"https://api.github.com/users/joseivanlopez","html_url":"https://github.com/joseivanlopez","followers_url":"https://api.github.com/users/joseivanlopez/followers","following_url":"https://api.github.com/users/joseivanlopez/following{/other_user}","gists_url":"https://api.github.com/users/joseivanlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/joseivanlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseivanlopez/subscriptions","organizations_url":"https://api.github.com/users/joseivanlopez/orgs","repos_url":"https://api.github.com/users/joseivanlopez/repos","events_url":"https://api.github.com/users/joseivanlopez/events{/privacy}","received_events_url":"https://api.github.com/users/joseivanlopez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joseivanlopez/yast-storage-ng","description":"Rewrite of https://github.com/yast/yast-storage","fork":true,"url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng","forks_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/forks","keys_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/teams","hooks_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/hooks","issue_events_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/issues/events{/number}","events_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/events","assignees_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/assignees{/user}","branches_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/branches{/branch}","tags_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/tags","blobs_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/languages","stargazers_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/stargazers","contributors_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/contributors","subscribers_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/subscribers","subscription_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/subscription","commits_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/contents/{+path}","compare_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/merges","archive_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/downloads","issues_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/issues{/number}","pulls_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/labels{/name}","releases_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/releases{/id}","deployments_url":"https://api.github.com/repos/joseivanlopez/yast-storage-ng/deployments","created_at":"2017-02-07T15:04:53Z","updated_at":"2017-02-07T15:04:56Z","pushed_at":"2018-06-04T11:13:19Z","git_url":"git://github.com/joseivanlopez/yast-storage-ng.git","ssh_url":"git@github.com:joseivanlopez/yast-storage-ng.git","clone_url":"https://github.com/joseivanlopez/yast-storage-ng.git","svn_url":"https://github.com/joseivanlopez/yast-storage-ng","homepage":"http://yast.github.io/","size":5794,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yast:SLE-15-GA","ref":"SLE-15-GA","sha":"4159dbcbcc20f442dfaf77047d9311244abad2c9","user":{"login":"yast","id":909990,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkwOTk5MA==","avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","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":46064409,"node_id":"MDEwOlJlcG9zaXRvcnk0NjA2NDQwOQ==","name":"yast-storage-ng","full_name":"yast/yast-storage-ng","owner":{"login":"yast","id":909990,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkwOTk5MA==","avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","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-storage-ng","description":"Rewrite of https://github.com/yast/yast-storage","fork":false,"url":"https://api.github.com/repos/yast/yast-storage-ng","forks_url":"https://api.github.com/repos/yast/yast-storage-ng/forks","keys_url":"https://api.github.com/repos/yast/yast-storage-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-storage-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-storage-ng/teams","hooks_url":"https://api.github.com/repos/yast/yast-storage-ng/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-storage-ng/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-storage-ng/events","assignees_url":"https://api.github.com/repos/yast/yast-storage-ng/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-storage-ng/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-storage-ng/tags","blobs_url":"https://api.github.com/repos/yast/yast-storage-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-storage-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-storage-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-storage-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-storage-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-storage-ng/languages","stargazers_url":"https://api.github.com/repos/yast/yast-storage-ng/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-storage-ng/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-storage-ng/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-storage-ng/subscription","commits_url":"https://api.github.com/repos/yast/yast-storage-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-storage-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-storage-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-storage-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-storage-ng/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-storage-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-storage-ng/merges","archive_url":"https://api.github.com/repos/yast/yast-storage-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-storage-ng/downloads","issues_url":"https://api.github.com/repos/yast/yast-storage-ng/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-storage-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-storage-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-storage-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-storage-ng/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-storage-ng/releases{/id}","deployments_url":"https://api.github.com/repos/yast/yast-storage-ng/deployments","created_at":"2015-11-12T16:09:03Z","updated_at":"2018-06-01T08:52:11Z","pushed_at":"2018-06-04T11:15:40Z","git_url":"git://github.com/yast/yast-storage-ng.git","ssh_url":"git@github.com:yast/yast-storage-ng.git","clone_url":"https://github.com/yast/yast-storage-ng.git","svn_url":"https://github.com/yast/yast-storage-ng","homepage":"http://yast.github.io/","size":5703,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":15,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652"},"html":{"href":"https://github.com/yast/yast-storage-ng/pull/652"},"issue":{"href":"https://api.github.com/repos/yast/yast-storage-ng/issues/652"},"comments":{"href":"https://api.github.com/repos/yast/yast-storage-ng/issues/652/comments"},"review_comments":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652/comments"},"review_comment":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yast/yast-storage-ng/pulls/652/commits"},"statuses":{"href":"https://api.github.com/repos/yast/yast-storage-ng/statuses/e3b565de9114a618b225e343a4f7f2ff7d35795c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jreidinger"}}