{"action":"created","comment":{"url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/comments/242330553","pull_request_review_id":185816592,"id":242330553,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjMzMDU1Mw==","diff_hunk":"@@ -24,6 +24,83 @@\n # branch.\n _MANIFEST_REV_BRANCH = 'manifest-rev'\n \n+class Reset(WestCommand):\n+    def __init__(self):\n+        super().__init__(\n+            'reset',\n+            _wrap('''\n+            Reset the repositories to a specific revision for the project given.\n+            Also reset other remote repositories to the related revision found in\n+            the manifest file.\n+            Additional git arguments, such as --hard can be provided using\n+            --git-args.'''))\n+\n+    def do_add_parser(self, parser_adder):\n+        return _add_parser(\n+            parser_adder, self,\n+            _arg('-r', '--revision',\n+                 dest='revision',\n+                 metavar='REVISION',\n+                 required=True,\n+                 help='''ToBeWritten'''),\n+            _arg('-g', '--git-args',\n+                 dest='gitargs',\n+                 metavar='GIT_ARGS',\n+                 default='',\n+                 required=False,\n+                 help='''Additional git arguments to be passed with 'git reset,'\n+                         e.g '--hard' '''),\n+            _arg('projects', metavar='PROJECT', nargs='?', default='zephyr')\n+            )\n+\n+    def do_run(self, args, user_args):\n+        # Arg parse, if project not given, use 'zephyr'\n+        # Only one project can be given.\n+        # ToDo: Check SHA is valid ?\n+        n=0\n+        args.projects = [args.projects]\n+        project = _projects(args)[0]\n+        manifest = _special_project(args, 'manifest')\n+        reset_projects = _all_projects(args)\n+\n+        while True:\n+            n += 1\n+\n+            sha = project.sha or project.revision\n+            rev_list = _git(project,\n+                   'rev-list --topo-order {} ^{}'.format(sha, args.revision),","path":"src/west/commands/project.py","position":48,"original_position":48,"commit_id":"e3043f8494a5f1a92c23b6f77fe55d20dbbe0a13","original_commit_id":"e3043f8494a5f1a92c23b6f77fe55d20dbbe0a13","user":{"login":"carlescufi","id":12450381,"node_id":"MDQ6VXNlcjEyNDUwMzgx","avatar_url":"https://avatars3.githubusercontent.com/u/12450381?v=4","gravatar_id":"","url":"https://api.github.com/users/carlescufi","html_url":"https://github.com/carlescufi","followers_url":"https://api.github.com/users/carlescufi/followers","following_url":"https://api.github.com/users/carlescufi/following{/other_user}","gists_url":"https://api.github.com/users/carlescufi/gists{/gist_id}","starred_url":"https://api.github.com/users/carlescufi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlescufi/subscriptions","organizations_url":"https://api.github.com/users/carlescufi/orgs","repos_url":"https://api.github.com/users/carlescufi/repos","events_url":"https://api.github.com/users/carlescufi/events{/privacy}","received_events_url":"https://api.github.com/users/carlescufi/received_events","type":"User","site_admin":false},"body":"Also I think this is clearer: `git rev-list --topo-order sha1..sha2`","created_at":"2018-12-17T21:54:54Z","updated_at":"2018-12-17T21:54:54Z","html_url":"https://github.com/zephyrproject-rtos/west/pull/142#discussion_r242330553","pull_request_url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/comments/242330553"},"html":{"href":"https://github.com/zephyrproject-rtos/west/pull/142#discussion_r242330553"},"pull_request":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142"}},"in_reply_to_id":242304643},"pull_request":{"url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142","id":239179690,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5MTc5Njkw","html_url":"https://github.com/zephyrproject-rtos/west/pull/142","diff_url":"https://github.com/zephyrproject-rtos/west/pull/142.diff","patch_url":"https://github.com/zephyrproject-rtos/west/pull/142.patch","issue_url":"https://api.github.com/repos/zephyrproject-rtos/west/issues/142","number":142,"state":"open","locked":false,"title":"[RFC][DNM] Feature west reset","user":{"login":"tejlmand","id":9802583,"node_id":"MDQ6VXNlcjk4MDI1ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/9802583?v=4","gravatar_id":"","url":"https://api.github.com/users/tejlmand","html_url":"https://github.com/tejlmand","followers_url":"https://api.github.com/users/tejlmand/followers","following_url":"https://api.github.com/users/tejlmand/following{/other_user}","gists_url":"https://api.github.com/users/tejlmand/gists{/gist_id}","starred_url":"https://api.github.com/users/tejlmand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejlmand/subscriptions","organizations_url":"https://api.github.com/users/tejlmand/orgs","repos_url":"https://api.github.com/users/tejlmand/repos","events_url":"https://api.github.com/users/tejlmand/events{/privacy}","received_events_url":"https://api.github.com/users/tejlmand/received_events","type":"User","site_admin":false},"body":"Initial prototype of a `west reset` feature in order to spawn further discussions.\r\n\r\nA supplementary repo has been created from which `zephyr` and `mcuboot` can be found here:\r\nhttps://github.com/tejlmand/manifest-reset.git\r\n\r\nThis manifest repo can be used to test the reset feature.\r\nExample:\r\n```\r\nwest init -m https://github.com/tejlmand/manifest-reset.git\r\nwest clone\r\n```\r\nRun `west reset` and see all repo jumping to correct revisions:\r\n```\r\nwest reset -r cb2445d8fe2023b5db1ff9816ccc126c8dfa0ca5 -g ' --hard' zephyr \r\n```\r\nwhich should give you:\r\n```\r\nHEAD is now at cb2445d tests: subsys: settings: extend nffs back-end testing\r\nHEAD is now at 4d20525 boot: zephyr: cleanup nrf52840_pca10059 configuration\r\n```\r\n\r\ngo forward:\r\n```\r\nwest pull\r\n```\r\nJump to manifest revision of zephyr, based upon mcuboot revision:\r\n```\r\nwest reset -r 68b305369463bc39d66b336b9b68d687e4ddd79f -g ' --hard' mcuboot\r\n```\r\nwhich should give you:\r\n```\r\nHEAD is now at d8285e4 pci: General code cleanup\r\nHEAD is now at 68b3053 Add deprecated warning to Jira and Confluence links\r\n```\r\n","created_at":"2018-12-17T15:15:33Z","updated_at":"2018-12-17T21:54:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c51b8d1bef3eb65af9773218c7950e0a58701cc","assignee":null,"assignees":[],"requested_reviewers":[{"login":"mbolivar","id":35088,"node_id":"MDQ6VXNlcjM1MDg4","avatar_url":"https://avatars3.githubusercontent.com/u/35088?v=4","gravatar_id":"","url":"https://api.github.com/users/mbolivar","html_url":"https://github.com/mbolivar","followers_url":"https://api.github.com/users/mbolivar/followers","following_url":"https://api.github.com/users/mbolivar/following{/other_user}","gists_url":"https://api.github.com/users/mbolivar/gists{/gist_id}","starred_url":"https://api.github.com/users/mbolivar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbolivar/subscriptions","organizations_url":"https://api.github.com/users/mbolivar/orgs","repos_url":"https://api.github.com/users/mbolivar/repos","events_url":"https://api.github.com/users/mbolivar/events{/privacy}","received_events_url":"https://api.github.com/users/mbolivar/received_events","type":"User","site_admin":false},{"login":"carlescufi","id":12450381,"node_id":"MDQ6VXNlcjEyNDUwMzgx","avatar_url":"https://avatars3.githubusercontent.com/u/12450381?v=4","gravatar_id":"","url":"https://api.github.com/users/carlescufi","html_url":"https://github.com/carlescufi","followers_url":"https://api.github.com/users/carlescufi/followers","following_url":"https://api.github.com/users/carlescufi/following{/other_user}","gists_url":"https://api.github.com/users/carlescufi/gists{/gist_id}","starred_url":"https://api.github.com/users/carlescufi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlescufi/subscriptions","organizations_url":"https://api.github.com/users/carlescufi/orgs","repos_url":"https://api.github.com/users/carlescufi/repos","events_url":"https://api.github.com/users/carlescufi/events{/privacy}","received_events_url":"https://api.github.com/users/carlescufi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142/commits","review_comments_url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142/comments","review_comment_url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zephyrproject-rtos/west/issues/142/comments","statuses_url":"https://api.github.com/repos/zephyrproject-rtos/west/statuses/e3043f8494a5f1a92c23b6f77fe55d20dbbe0a13","head":{"label":"tejlmand:feature_west_reset","ref":"feature_west_reset","sha":"e3043f8494a5f1a92c23b6f77fe55d20dbbe0a13","user":{"login":"tejlmand","id":9802583,"node_id":"MDQ6VXNlcjk4MDI1ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/9802583?v=4","gravatar_id":"","url":"https://api.github.com/users/tejlmand","html_url":"https://github.com/tejlmand","followers_url":"https://api.github.com/users/tejlmand/followers","following_url":"https://api.github.com/users/tejlmand/following{/other_user}","gists_url":"https://api.github.com/users/tejlmand/gists{/gist_id}","starred_url":"https://api.github.com/users/tejlmand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejlmand/subscriptions","organizations_url":"https://api.github.com/users/tejlmand/orgs","repos_url":"https://api.github.com/users/tejlmand/repos","events_url":"https://api.github.com/users/tejlmand/events{/privacy}","received_events_url":"https://api.github.com/users/tejlmand/received_events","type":"User","site_admin":false},"repo":{"id":158535377,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg1MzUzNzc=","name":"west","full_name":"tejlmand/west","private":false,"owner":{"login":"tejlmand","id":9802583,"node_id":"MDQ6VXNlcjk4MDI1ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/9802583?v=4","gravatar_id":"","url":"https://api.github.com/users/tejlmand","html_url":"https://github.com/tejlmand","followers_url":"https://api.github.com/users/tejlmand/followers","following_url":"https://api.github.com/users/tejlmand/following{/other_user}","gists_url":"https://api.github.com/users/tejlmand/gists{/gist_id}","starred_url":"https://api.github.com/users/tejlmand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejlmand/subscriptions","organizations_url":"https://api.github.com/users/tejlmand/orgs","repos_url":"https://api.github.com/users/tejlmand/repos","events_url":"https://api.github.com/users/tejlmand/events{/privacy}","received_events_url":"https://api.github.com/users/tejlmand/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tejlmand/west","description":null,"fork":true,"url":"https://api.github.com/repos/tejlmand/west","forks_url":"https://api.github.com/repos/tejlmand/west/forks","keys_url":"https://api.github.com/repos/tejlmand/west/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tejlmand/west/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tejlmand/west/teams","hooks_url":"https://api.github.com/repos/tejlmand/west/hooks","issue_events_url":"https://api.github.com/repos/tejlmand/west/issues/events{/number}","events_url":"https://api.github.com/repos/tejlmand/west/events","assignees_url":"https://api.github.com/repos/tejlmand/west/assignees{/user}","branches_url":"https://api.github.com/repos/tejlmand/west/branches{/branch}","tags_url":"https://api.github.com/repos/tejlmand/west/tags","blobs_url":"https://api.github.com/repos/tejlmand/west/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tejlmand/west/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tejlmand/west/git/refs{/sha}","trees_url":"https://api.github.com/repos/tejlmand/west/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tejlmand/west/statuses/{sha}","languages_url":"https://api.github.com/repos/tejlmand/west/languages","stargazers_url":"https://api.github.com/repos/tejlmand/west/stargazers","contributors_url":"https://api.github.com/repos/tejlmand/west/contributors","subscribers_url":"https://api.github.com/repos/tejlmand/west/subscribers","subscription_url":"https://api.github.com/repos/tejlmand/west/subscription","commits_url":"https://api.github.com/repos/tejlmand/west/commits{/sha}","git_commits_url":"https://api.github.com/repos/tejlmand/west/git/commits{/sha}","comments_url":"https://api.github.com/repos/tejlmand/west/comments{/number}","issue_comment_url":"https://api.github.com/repos/tejlmand/west/issues/comments{/number}","contents_url":"https://api.github.com/repos/tejlmand/west/contents/{+path}","compare_url":"https://api.github.com/repos/tejlmand/west/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tejlmand/west/merges","archive_url":"https://api.github.com/repos/tejlmand/west/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tejlmand/west/downloads","issues_url":"https://api.github.com/repos/tejlmand/west/issues{/number}","pulls_url":"https://api.github.com/repos/tejlmand/west/pulls{/number}","milestones_url":"https://api.github.com/repos/tejlmand/west/milestones{/number}","notifications_url":"https://api.github.com/repos/tejlmand/west/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tejlmand/west/labels{/name}","releases_url":"https://api.github.com/repos/tejlmand/west/releases{/id}","deployments_url":"https://api.github.com/repos/tejlmand/west/deployments","created_at":"2018-11-21T11:07:19Z","updated_at":"2018-12-11T14:59:39Z","pushed_at":"2018-12-17T15:03:40Z","git_url":"git://github.com/tejlmand/west.git","ssh_url":"git@github.com:tejlmand/west.git","clone_url":"https://github.com/tejlmand/west.git","svn_url":"https://github.com/tejlmand/west","homepage":null,"size":343,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zephyrproject-rtos:master","ref":"master","sha":"487a03cfa1aeff7cdfcf0de01c3957cebd7deb1f","user":{"login":"zephyrproject-rtos","id":19595895,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NTk1ODk1","avatar_url":"https://avatars2.githubusercontent.com/u/19595895?v=4","gravatar_id":"","url":"https://api.github.com/users/zephyrproject-rtos","html_url":"https://github.com/zephyrproject-rtos","followers_url":"https://api.github.com/users/zephyrproject-rtos/followers","following_url":"https://api.github.com/users/zephyrproject-rtos/following{/other_user}","gists_url":"https://api.github.com/users/zephyrproject-rtos/gists{/gist_id}","starred_url":"https://api.github.com/users/zephyrproject-rtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zephyrproject-rtos/subscriptions","organizations_url":"https://api.github.com/users/zephyrproject-rtos/orgs","repos_url":"https://api.github.com/users/zephyrproject-rtos/repos","events_url":"https://api.github.com/users/zephyrproject-rtos/events{/privacy}","received_events_url":"https://api.github.com/users/zephyrproject-rtos/received_events","type":"Organization","site_admin":false},"repo":{"id":134577458,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ1Nzc0NTg=","name":"west","full_name":"zephyrproject-rtos/west","private":false,"owner":{"login":"zephyrproject-rtos","id":19595895,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NTk1ODk1","avatar_url":"https://avatars2.githubusercontent.com/u/19595895?v=4","gravatar_id":"","url":"https://api.github.com/users/zephyrproject-rtos","html_url":"https://github.com/zephyrproject-rtos","followers_url":"https://api.github.com/users/zephyrproject-rtos/followers","following_url":"https://api.github.com/users/zephyrproject-rtos/following{/other_user}","gists_url":"https://api.github.com/users/zephyrproject-rtos/gists{/gist_id}","starred_url":"https://api.github.com/users/zephyrproject-rtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zephyrproject-rtos/subscriptions","organizations_url":"https://api.github.com/users/zephyrproject-rtos/orgs","repos_url":"https://api.github.com/users/zephyrproject-rtos/repos","events_url":"https://api.github.com/users/zephyrproject-rtos/events{/privacy}","received_events_url":"https://api.github.com/users/zephyrproject-rtos/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/zephyrproject-rtos/west","description":null,"fork":false,"url":"https://api.github.com/repos/zephyrproject-rtos/west","forks_url":"https://api.github.com/repos/zephyrproject-rtos/west/forks","keys_url":"https://api.github.com/repos/zephyrproject-rtos/west/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zephyrproject-rtos/west/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zephyrproject-rtos/west/teams","hooks_url":"https://api.github.com/repos/zephyrproject-rtos/west/hooks","issue_events_url":"https://api.github.com/repos/zephyrproject-rtos/west/issues/events{/number}","events_url":"https://api.github.com/repos/zephyrproject-rtos/west/events","assignees_url":"https://api.github.com/repos/zephyrproject-rtos/west/assignees{/user}","branches_url":"https://api.github.com/repos/zephyrproject-rtos/west/branches{/branch}","tags_url":"https://api.github.com/repos/zephyrproject-rtos/west/tags","blobs_url":"https://api.github.com/repos/zephyrproject-rtos/west/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zephyrproject-rtos/west/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zephyrproject-rtos/west/git/refs{/sha}","trees_url":"https://api.github.com/repos/zephyrproject-rtos/west/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zephyrproject-rtos/west/statuses/{sha}","languages_url":"https://api.github.com/repos/zephyrproject-rtos/west/languages","stargazers_url":"https://api.github.com/repos/zephyrproject-rtos/west/stargazers","contributors_url":"https://api.github.com/repos/zephyrproject-rtos/west/contributors","subscribers_url":"https://api.github.com/repos/zephyrproject-rtos/west/subscribers","subscription_url":"https://api.github.com/repos/zephyrproject-rtos/west/subscription","commits_url":"https://api.github.com/repos/zephyrproject-rtos/west/commits{/sha}","git_commits_url":"https://api.github.com/repos/zephyrproject-rtos/west/git/commits{/sha}","comments_url":"https://api.github.com/repos/zephyrproject-rtos/west/comments{/number}","issue_comment_url":"https://api.github.com/repos/zephyrproject-rtos/west/issues/comments{/number}","contents_url":"https://api.github.com/repos/zephyrproject-rtos/west/contents/{+path}","compare_url":"https://api.github.com/repos/zephyrproject-rtos/west/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zephyrproject-rtos/west/merges","archive_url":"https://api.github.com/repos/zephyrproject-rtos/west/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zephyrproject-rtos/west/downloads","issues_url":"https://api.github.com/repos/zephyrproject-rtos/west/issues{/number}","pulls_url":"https://api.github.com/repos/zephyrproject-rtos/west/pulls{/number}","milestones_url":"https://api.github.com/repos/zephyrproject-rtos/west/milestones{/number}","notifications_url":"https://api.github.com/repos/zephyrproject-rtos/west/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zephyrproject-rtos/west/labels{/name}","releases_url":"https://api.github.com/repos/zephyrproject-rtos/west/releases{/id}","deployments_url":"https://api.github.com/repos/zephyrproject-rtos/west/deployments","created_at":"2018-05-23T13:56:05Z","updated_at":"2018-12-10T20:01:30Z","pushed_at":"2018-12-17T15:15:34Z","git_url":"git://github.com/zephyrproject-rtos/west.git","ssh_url":"git@github.com:zephyrproject-rtos/west.git","clone_url":"https://github.com/zephyrproject-rtos/west.git","svn_url":"https://github.com/zephyrproject-rtos/west","homepage":null,"size":330,"stargazers_count":10,"watchers_count":10,"language":"Python","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":26,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":15,"open_issues":26,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142"},"html":{"href":"https://github.com/zephyrproject-rtos/west/pull/142"},"issue":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/issues/142"},"comments":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/issues/142/comments"},"review_comments":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142/comments"},"review_comment":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/pulls/142/commits"},"statuses":{"href":"https://api.github.com/repos/zephyrproject-rtos/west/statuses/e3043f8494a5f1a92c23b6f77fe55d20dbbe0a13"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"carlescufi"}}