{"action":"created","comment":{"url":"https://api.github.com/repos/BobBuildTool/bob/pulls/comments/85835214","pull_request_review_id":6517515,"id":85835214,"diff_hunk":"@@ -576,6 +577,62 @@ def isDeterministic(self):\n     def hasJenkinsPlugin(self):\n         return True\n \n+    def callGit(self, workspacePath, *args):\n+        cmdLine = ['git']\n+        for arg in args:\n+            cmdLine.append(arg)\n+        try:\n+            output = subprocess.check_output(cmdLine, cwd=os.path.join(os.getcwd(),workspacePath, self.__dir),\n+                universal_newlines=True, stderr=subprocess.STDOUT)\n+        except subprocess.CalledProcessError as e:\n+            raise BuildError(\"git error: '{}' '{}'\".format(\" \".join(cmdLine), e.output))\n+        return output\n+\n+    def status(self, workspacePath, dir, verbose):\n+        if not os.path.exists(os.path.join(os.getcwd(), workspacePath, self.__dir)):\n+            return 'error'\n+\n+        ret = 0\n+        if self.__commit:\n+            output = self.callGit(workspacePath, 'rev-parse', 'HEAD').rstrip()\n+            if output != self.__commit:\n+                ret += 1\n+                if verbose:\n+                    print(colorize(\"    ! should have commitId {} but commitID is {}\".format(self.__commit, output), \"33\"))\n+        elif self.__tag:\n+            output = self.callGit(workspacePath, 'describe', '--tags', '--always').rstrip()\n+            if output != self.__tag:\n+                ret += 1\n+                if verbose:\n+                    print(colorize(\"    ! should be on tag {} but tag is {}\".format(self.__tag, output), \"33\"))\n+        elif self.__branch:\n+            output = self.callGit(workspacePath, 'rev-parse', '--abbrev-ref', 'HEAD').rstrip()\n+            if output != self.__branch:\n+                ret += 1\n+                if verbose:\n+                    print(colorize(\"    ! should be on branch {} but currently on {}\".format(self.__branch, output), \"33\"))\n+\n+        output = self.callGit(workspacePath, 'status', '--porcelain')\n+        if len(output):\n+            if verbose:\n+                print(colorize(\"    ! has modifications:\", \"33\"))\n+                for line in output.split('\\n'):\n+                    print('      '+line.rstrip())\n+            ret += 1\n+\n+        output = self.callGit(workspacePath, 'log', '--all', '--not', '--remotes')\n+        if len(output):\n+            if verbose:\n+                print(colorize(\"    ! has unpushed commit(s):\", \"33\"))\n+                for line in output.split('\\n'):\n+                    print('      '+line.rstrip())\n+            ret += 1","path":"pym/bob/input.py","position":61,"original_position":61,"commit_id":"7058b9075f529cf661505d9e1aade8ed64cf0a57","original_commit_id":"7058b9075f529cf661505d9e1aade8ed64cf0a57","user":{"login":"jkloetzke","id":234300,"avatar_url":"https://avatars.githubusercontent.com/u/234300?v=3","gravatar_id":"","url":"https://api.github.com/users/jkloetzke","html_url":"https://github.com/jkloetzke","followers_url":"https://api.github.com/users/jkloetzke/followers","following_url":"https://api.github.com/users/jkloetzke/following{/other_user}","gists_url":"https://api.github.com/users/jkloetzke/gists{/gist_id}","starred_url":"https://api.github.com/users/jkloetzke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkloetzke/subscriptions","organizations_url":"https://api.github.com/users/jkloetzke/orgs","repos_url":"https://api.github.com/users/jkloetzke/repos","events_url":"https://api.github.com/users/jkloetzke/events{/privacy}","received_events_url":"https://api.github.com/users/jkloetzke/received_events","type":"User","site_admin":false},"body":"Hmm, I think this check does not qualify the repository as \"unclean\" in the sense that it must be moved to the attic. The user might have just tested something previously and might have switched back to the upstream branch.","created_at":"2016-10-31T21:17:47Z","updated_at":"2016-10-31T21:18:47Z","html_url":"https://github.com/BobBuildTool/bob/pull/62#discussion_r85835214","pull_request_url":"https://api.github.com/repos/BobBuildTool/bob/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/comments/85835214"},"html":{"href":"https://github.com/BobBuildTool/bob/pull/62#discussion_r85835214"},"pull_request":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/BobBuildTool/bob/pulls/62","id":91481557,"html_url":"https://github.com/BobBuildTool/bob/pull/62","diff_url":"https://github.com/BobBuildTool/bob/pull/62.diff","patch_url":"https://github.com/BobBuildTool/bob/pull/62.patch","issue_url":"https://api.github.com/repos/BobBuildTool/bob/issues/62","number":62,"state":"open","locked":false,"title":"bob status and --force-checkout [WIP] [RFC]","user":{"login":"rhubert","id":937126,"avatar_url":"https://avatars.githubusercontent.com/u/937126?v=3","gravatar_id":"","url":"https://api.github.com/users/rhubert","html_url":"https://github.com/rhubert","followers_url":"https://api.github.com/users/rhubert/followers","following_url":"https://api.github.com/users/rhubert/following{/other_user}","gists_url":"https://api.github.com/users/rhubert/gists{/gist_id}","starred_url":"https://api.github.com/users/rhubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhubert/subscriptions","organizations_url":"https://api.github.com/users/rhubert/orgs","repos_url":"https://api.github.com/users/rhubert/repos","events_url":"https://api.github.com/users/rhubert/events{/privacy}","received_events_url":"https://api.github.com/users/rhubert/received_events","type":"User","site_admin":false},"body":"As discussed on the mailing list this is my first attempt for bob status. \n\nOne question that needs to be discussed is: What should --force-checkout do for url scms or if error is returned from Svn/Git? (Nothing / move to attic / delete old sources without moving to attic )? As a user I would assume that after --force-checkout the sources are in a clean state so moving to attic would the best?\n","created_at":"2016-10-29T07:09:23Z","updated_at":"2016-10-31T21:18:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7b727f71eff423a775c6d8e43bc7df48d544e63","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/BobBuildTool/bob/pulls/62/commits","review_comments_url":"https://api.github.com/repos/BobBuildTool/bob/pulls/62/comments","review_comment_url":"https://api.github.com/repos/BobBuildTool/bob/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BobBuildTool/bob/issues/62/comments","statuses_url":"https://api.github.com/repos/BobBuildTool/bob/statuses/7058b9075f529cf661505d9e1aade8ed64cf0a57","head":{"label":"rhubert:status","ref":"status","sha":"7058b9075f529cf661505d9e1aade8ed64cf0a57","user":{"login":"rhubert","id":937126,"avatar_url":"https://avatars.githubusercontent.com/u/937126?v=3","gravatar_id":"","url":"https://api.github.com/users/rhubert","html_url":"https://github.com/rhubert","followers_url":"https://api.github.com/users/rhubert/followers","following_url":"https://api.github.com/users/rhubert/following{/other_user}","gists_url":"https://api.github.com/users/rhubert/gists{/gist_id}","starred_url":"https://api.github.com/users/rhubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhubert/subscriptions","organizations_url":"https://api.github.com/users/rhubert/orgs","repos_url":"https://api.github.com/users/rhubert/repos","events_url":"https://api.github.com/users/rhubert/events{/privacy}","received_events_url":"https://api.github.com/users/rhubert/received_events","type":"User","site_admin":false},"repo":{"id":49701228,"name":"bob","full_name":"rhubert/bob","owner":{"login":"rhubert","id":937126,"avatar_url":"https://avatars.githubusercontent.com/u/937126?v=3","gravatar_id":"","url":"https://api.github.com/users/rhubert","html_url":"https://github.com/rhubert","followers_url":"https://api.github.com/users/rhubert/followers","following_url":"https://api.github.com/users/rhubert/following{/other_user}","gists_url":"https://api.github.com/users/rhubert/gists{/gist_id}","starred_url":"https://api.github.com/users/rhubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhubert/subscriptions","organizations_url":"https://api.github.com/users/rhubert/orgs","repos_url":"https://api.github.com/users/rhubert/repos","events_url":"https://api.github.com/users/rhubert/events{/privacy}","received_events_url":"https://api.github.com/users/rhubert/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhubert/bob","description":"Bob build tool","fork":true,"url":"https://api.github.com/repos/rhubert/bob","forks_url":"https://api.github.com/repos/rhubert/bob/forks","keys_url":"https://api.github.com/repos/rhubert/bob/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhubert/bob/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhubert/bob/teams","hooks_url":"https://api.github.com/repos/rhubert/bob/hooks","issue_events_url":"https://api.github.com/repos/rhubert/bob/issues/events{/number}","events_url":"https://api.github.com/repos/rhubert/bob/events","assignees_url":"https://api.github.com/repos/rhubert/bob/assignees{/user}","branches_url":"https://api.github.com/repos/rhubert/bob/branches{/branch}","tags_url":"https://api.github.com/repos/rhubert/bob/tags","blobs_url":"https://api.github.com/repos/rhubert/bob/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhubert/bob/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhubert/bob/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhubert/bob/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhubert/bob/statuses/{sha}","languages_url":"https://api.github.com/repos/rhubert/bob/languages","stargazers_url":"https://api.github.com/repos/rhubert/bob/stargazers","contributors_url":"https://api.github.com/repos/rhubert/bob/contributors","subscribers_url":"https://api.github.com/repos/rhubert/bob/subscribers","subscription_url":"https://api.github.com/repos/rhubert/bob/subscription","commits_url":"https://api.github.com/repos/rhubert/bob/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhubert/bob/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhubert/bob/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhubert/bob/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhubert/bob/contents/{+path}","compare_url":"https://api.github.com/repos/rhubert/bob/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhubert/bob/merges","archive_url":"https://api.github.com/repos/rhubert/bob/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhubert/bob/downloads","issues_url":"https://api.github.com/repos/rhubert/bob/issues{/number}","pulls_url":"https://api.github.com/repos/rhubert/bob/pulls{/number}","milestones_url":"https://api.github.com/repos/rhubert/bob/milestones{/number}","notifications_url":"https://api.github.com/repos/rhubert/bob/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhubert/bob/labels{/name}","releases_url":"https://api.github.com/repos/rhubert/bob/releases{/id}","deployments_url":"https://api.github.com/repos/rhubert/bob/deployments","created_at":"2016-01-15T06:35:30Z","updated_at":"2016-01-15T06:35:31Z","pushed_at":"2016-10-31T20:26:39Z","git_url":"git://github.com/rhubert/bob.git","ssh_url":"git@github.com:rhubert/bob.git","clone_url":"https://github.com/rhubert/bob.git","svn_url":"https://github.com/rhubert/bob","homepage":null,"size":806,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"BobBuildTool:master","ref":"master","sha":"b5d0a972d8192b2aeeea736e3abc94fcae8c2bab","user":{"login":"BobBuildTool","id":16581788,"avatar_url":"https://avatars.githubusercontent.com/u/16581788?v=3","gravatar_id":"","url":"https://api.github.com/users/BobBuildTool","html_url":"https://github.com/BobBuildTool","followers_url":"https://api.github.com/users/BobBuildTool/followers","following_url":"https://api.github.com/users/BobBuildTool/following{/other_user}","gists_url":"https://api.github.com/users/BobBuildTool/gists{/gist_id}","starred_url":"https://api.github.com/users/BobBuildTool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BobBuildTool/subscriptions","organizations_url":"https://api.github.com/users/BobBuildTool/orgs","repos_url":"https://api.github.com/users/BobBuildTool/repos","events_url":"https://api.github.com/users/BobBuildTool/events{/privacy}","received_events_url":"https://api.github.com/users/BobBuildTool/received_events","type":"Organization","site_admin":false},"repo":{"id":49201667,"name":"bob","full_name":"BobBuildTool/bob","owner":{"login":"BobBuildTool","id":16581788,"avatar_url":"https://avatars.githubusercontent.com/u/16581788?v=3","gravatar_id":"","url":"https://api.github.com/users/BobBuildTool","html_url":"https://github.com/BobBuildTool","followers_url":"https://api.github.com/users/BobBuildTool/followers","following_url":"https://api.github.com/users/BobBuildTool/following{/other_user}","gists_url":"https://api.github.com/users/BobBuildTool/gists{/gist_id}","starred_url":"https://api.github.com/users/BobBuildTool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BobBuildTool/subscriptions","organizations_url":"https://api.github.com/users/BobBuildTool/orgs","repos_url":"https://api.github.com/users/BobBuildTool/repos","events_url":"https://api.github.com/users/BobBuildTool/events{/privacy}","received_events_url":"https://api.github.com/users/BobBuildTool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BobBuildTool/bob","description":"Bob build tool","fork":false,"url":"https://api.github.com/repos/BobBuildTool/bob","forks_url":"https://api.github.com/repos/BobBuildTool/bob/forks","keys_url":"https://api.github.com/repos/BobBuildTool/bob/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BobBuildTool/bob/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BobBuildTool/bob/teams","hooks_url":"https://api.github.com/repos/BobBuildTool/bob/hooks","issue_events_url":"https://api.github.com/repos/BobBuildTool/bob/issues/events{/number}","events_url":"https://api.github.com/repos/BobBuildTool/bob/events","assignees_url":"https://api.github.com/repos/BobBuildTool/bob/assignees{/user}","branches_url":"https://api.github.com/repos/BobBuildTool/bob/branches{/branch}","tags_url":"https://api.github.com/repos/BobBuildTool/bob/tags","blobs_url":"https://api.github.com/repos/BobBuildTool/bob/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BobBuildTool/bob/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BobBuildTool/bob/git/refs{/sha}","trees_url":"https://api.github.com/repos/BobBuildTool/bob/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BobBuildTool/bob/statuses/{sha}","languages_url":"https://api.github.com/repos/BobBuildTool/bob/languages","stargazers_url":"https://api.github.com/repos/BobBuildTool/bob/stargazers","contributors_url":"https://api.github.com/repos/BobBuildTool/bob/contributors","subscribers_url":"https://api.github.com/repos/BobBuildTool/bob/subscribers","subscription_url":"https://api.github.com/repos/BobBuildTool/bob/subscription","commits_url":"https://api.github.com/repos/BobBuildTool/bob/commits{/sha}","git_commits_url":"https://api.github.com/repos/BobBuildTool/bob/git/commits{/sha}","comments_url":"https://api.github.com/repos/BobBuildTool/bob/comments{/number}","issue_comment_url":"https://api.github.com/repos/BobBuildTool/bob/issues/comments{/number}","contents_url":"https://api.github.com/repos/BobBuildTool/bob/contents/{+path}","compare_url":"https://api.github.com/repos/BobBuildTool/bob/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BobBuildTool/bob/merges","archive_url":"https://api.github.com/repos/BobBuildTool/bob/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BobBuildTool/bob/downloads","issues_url":"https://api.github.com/repos/BobBuildTool/bob/issues{/number}","pulls_url":"https://api.github.com/repos/BobBuildTool/bob/pulls{/number}","milestones_url":"https://api.github.com/repos/BobBuildTool/bob/milestones{/number}","notifications_url":"https://api.github.com/repos/BobBuildTool/bob/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BobBuildTool/bob/labels{/name}","releases_url":"https://api.github.com/repos/BobBuildTool/bob/releases{/id}","deployments_url":"https://api.github.com/repos/BobBuildTool/bob/deployments","created_at":"2016-01-07T11:49:10Z","updated_at":"2016-10-24T15:04:04Z","pushed_at":"2016-10-31T20:46:12Z","git_url":"git://github.com/BobBuildTool/bob.git","ssh_url":"git@github.com:BobBuildTool/bob.git","clone_url":"https://github.com/BobBuildTool/bob.git","svn_url":"https://github.com/BobBuildTool/bob","homepage":null,"size":833,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/62"},"html":{"href":"https://github.com/BobBuildTool/bob/pull/62"},"issue":{"href":"https://api.github.com/repos/BobBuildTool/bob/issues/62"},"comments":{"href":"https://api.github.com/repos/BobBuildTool/bob/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BobBuildTool/bob/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/BobBuildTool/bob/statuses/7058b9075f529cf661505d9e1aade8ed64cf0a57"}}}}
{"actor":{"display_login":"jkloetzke"}}