{"action":"created","comment":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/27366741","id":27366741,"diff_hunk":"@@ -7,72 +7,153 @@\n import builtins\n import platform\n import subprocess\n+from datetime import datetime\n+from functools import partial\n from warnings import warn\n+from collections import MutableMapping\n \n from xonsh import __version__ as XONSH_VERSION\n from xonsh.tools import TERM_COLORS\n \n-def current_branch(cwd=None):\n-    \"\"\"Gets the branch for a current working directory. Returns None\n-    if the cwd is not a repository.  This currently only works for git, \n-    bust should be extended in the future.\n+# This is only needed because of the way that we create prompt objects in\n+# shell.py.  If we find a way to create prompt objects before\n+# environ.add_prompt_var() can be called then we wouldn't need this.\n+_prompt_vars_queue = {}","path":"xonsh/environ.py","position":19,"original_position":19,"commit_id":"448f3cbbdbc25e803de2435924caad7fe47f0f31","original_commit_id":"448f3cbbdbc25e803de2435924caad7fe47f0f31","user":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"body":"It's not a constant.  It's being modified during runtime.\r\n\r\nIt can't be an instance variable because we may not have an instance when the toplevel add_prompt_vars() function that @wrywerytwreywery wanted to have is called.\r\n","created_at":"2015-03-30T04:58:05Z","updated_at":"2015-03-30T04:58:05Z","html_url":"https://github.com/scopatz/xonsh/pull/162#discussion_r27366741","pull_request_url":"https://api.github.com/repos/scopatz/xonsh/pulls/162","_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/27366741"},"html":{"href":"https://github.com/scopatz/xonsh/pull/162#discussion_r27366741"},"pull_request":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/162"}}},"pull_request":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/162","id":32177115,"html_url":"https://github.com/scopatz/xonsh/pull/162","diff_url":"https://github.com/scopatz/xonsh/pull/162.diff","patch_url":"https://github.com/scopatz/xonsh/pull/162.patch","issue_url":"https://api.github.com/repos/scopatz/xonsh/issues/162","number":162,"state":"open","locked":false,"title":"Prompt via prompt","user":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"body":"Alternate implementation of prompt vars customization.  This makes all customization of prompts happen by giving a callable to the $PROMPT environment variable instead of having separate ways to customize prompts by giving $PROMPT a callable or giving $PROMPT_FORMATTER a prompt formatter.","created_at":"2015-03-29T06:00:51Z","updated_at":"2015-03-30T04:58:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"484089420d881ae8727554d6c4ff7553916288b1","assignee":null,"milestone":{"url":"https://api.github.com/repos/scopatz/xonsh/milestones/1","html_url":"https://github.com/scopatz/xonsh/milestones/v0.2","labels_url":"https://api.github.com/repos/scopatz/xonsh/milestones/1/labels","id":1013181,"number":1,"title":"v0.2","description":"","creator":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"open_issues":34,"closed_issues":126,"state":"open","created_at":"2015-03-09T18:29:10Z","updated_at":"2015-03-30T04:04:08Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/scopatz/xonsh/pulls/162/commits","review_comments_url":"https://api.github.com/repos/scopatz/xonsh/pulls/162/comments","review_comment_url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scopatz/xonsh/issues/162/comments","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/448f3cbbdbc25e803de2435924caad7fe47f0f31","head":{"label":"abadger:prompt-via-prompt","ref":"prompt-via-prompt","sha":"448f3cbbdbc25e803de2435924caad7fe47f0f31","user":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"repo":{"id":32640769,"name":"xonsh","full_name":"abadger/xonsh","owner":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abadger/xonsh","description":"xonsh is a Python-ish, BASHwards-compatible shell.","fork":true,"url":"https://api.github.com/repos/abadger/xonsh","forks_url":"https://api.github.com/repos/abadger/xonsh/forks","keys_url":"https://api.github.com/repos/abadger/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abadger/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abadger/xonsh/teams","hooks_url":"https://api.github.com/repos/abadger/xonsh/hooks","issue_events_url":"https://api.github.com/repos/abadger/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/abadger/xonsh/events","assignees_url":"https://api.github.com/repos/abadger/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/abadger/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/abadger/xonsh/tags","blobs_url":"https://api.github.com/repos/abadger/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abadger/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abadger/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/abadger/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abadger/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/abadger/xonsh/languages","stargazers_url":"https://api.github.com/repos/abadger/xonsh/stargazers","contributors_url":"https://api.github.com/repos/abadger/xonsh/contributors","subscribers_url":"https://api.github.com/repos/abadger/xonsh/subscribers","subscription_url":"https://api.github.com/repos/abadger/xonsh/subscription","commits_url":"https://api.github.com/repos/abadger/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/abadger/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/abadger/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/abadger/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/abadger/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/abadger/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abadger/xonsh/merges","archive_url":"https://api.github.com/repos/abadger/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abadger/xonsh/downloads","issues_url":"https://api.github.com/repos/abadger/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/abadger/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/abadger/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/abadger/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abadger/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/abadger/xonsh/releases{/id}","created_at":"2015-03-21T16:50:43Z","updated_at":"2015-03-26T02:24:05Z","pushed_at":"2015-03-29T05:57:30Z","git_url":"git://github.com/abadger/xonsh.git","ssh_url":"git@github.com:abadger/xonsh.git","clone_url":"https://github.com/abadger/xonsh.git","svn_url":"https://github.com/abadger/xonsh","homepage":"http://xonsh.org","size":1946,"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":"scopatz:master","ref":"master","sha":"e8aadbb2989b6c0476450c7a45879859149dd877","user":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"repo":{"id":29620400,"name":"xonsh","full_name":"scopatz/xonsh","owner":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scopatz/xonsh","description":"xonsh is a Python-ish, BASHwards-compatible shell.","fork":false,"url":"https://api.github.com/repos/scopatz/xonsh","forks_url":"https://api.github.com/repos/scopatz/xonsh/forks","keys_url":"https://api.github.com/repos/scopatz/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scopatz/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scopatz/xonsh/teams","hooks_url":"https://api.github.com/repos/scopatz/xonsh/hooks","issue_events_url":"https://api.github.com/repos/scopatz/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/scopatz/xonsh/events","assignees_url":"https://api.github.com/repos/scopatz/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/scopatz/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/scopatz/xonsh/tags","blobs_url":"https://api.github.com/repos/scopatz/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scopatz/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scopatz/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/scopatz/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/scopatz/xonsh/languages","stargazers_url":"https://api.github.com/repos/scopatz/xonsh/stargazers","contributors_url":"https://api.github.com/repos/scopatz/xonsh/contributors","subscribers_url":"https://api.github.com/repos/scopatz/xonsh/subscribers","subscription_url":"https://api.github.com/repos/scopatz/xonsh/subscription","commits_url":"https://api.github.com/repos/scopatz/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/scopatz/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/scopatz/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/scopatz/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/scopatz/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/scopatz/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scopatz/xonsh/merges","archive_url":"https://api.github.com/repos/scopatz/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scopatz/xonsh/downloads","issues_url":"https://api.github.com/repos/scopatz/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/scopatz/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/scopatz/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/scopatz/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scopatz/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/scopatz/xonsh/releases{/id}","created_at":"2015-01-21T22:05:27Z","updated_at":"2015-03-30T04:56:46Z","pushed_at":"2015-03-30T04:56:46Z","git_url":"git://github.com/scopatz/xonsh.git","ssh_url":"git@github.com:scopatz/xonsh.git","clone_url":"https://github.com/scopatz/xonsh.git","svn_url":"https://github.com/scopatz/xonsh","homepage":"http://xonsh.org","size":3915,"stargazers_count":335,"watchers_count":335,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":36,"forks":30,"open_issues":36,"watchers":335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/162"},"html":{"href":"https://github.com/scopatz/xonsh/pull/162"},"issue":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/162"},"comments":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/162/comments"},"review_comments":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/162/comments"},"review_comment":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/162/commits"},"statuses":{"href":"https://api.github.com/repos/scopatz/xonsh/statuses/448f3cbbdbc25e803de2435924caad7fe47f0f31"}}}}