parameters: (pkg_path)
return_statement: return '(none found)', '<not found>'
docstring: Get short form of commit hash given directory `pkg_path`
  
      We get the commit hash from (in order of preference):
  
      * IPython.utils._sysinfo.commit
      * git output, if we are in a git repository
  
      If these fail, we return a not-found placeholder tuple
  
      Parameters
      ----------
      pkg_path : str
         directory containing package
         only used for getting commit from active repo
  
      Returns
      -------
      hash_from : str
         Where we got the hash from - description
      hash_str : str
         short form of hash
docstring_summary: Get short form of commit hash given directory `pkg_path`
docstring_tokens: Get short form of commit hash given directory pkg_path
function: def pkg_commit_hash(pkg_path):
      """Get short form of commit hash given directory `pkg_path`
  
      We get the commit hash from (in order of preference):
  
      * IPython.utils._sysinfo.commit
      * git output, if we are in a git repository
  
      If these fail, we return a not-found placeholder tuple
  
      Parameters
      ----------
      pkg_path : str
         directory containing package
         only used for getting commit from active repo
  
      Returns
      -------
      hash_from : str
         Where we got the hash from - description
      hash_str : str
         short form of hash
      """
      # Try and get commit from written commit text file
      if _sysinfo.commit:
          return "installation", _sysinfo.commit
  
      # maybe we are in a repository
      proc = subprocess.Popen('git rev-parse --short HEAD'.split(' '),
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              cwd=pkg_path)
      repo_commit, _ = proc.communicate()
      if repo_commit:
          return 'repository', repo_commit.strip().decode('ascii')
      return '(none found)', '<not found>'
function_tokens: def pkg_commit_hash ( pkg_path ) : # Try and get commit from written commit text file if _sysinfo . commit : return "installation" , _sysinfo . commit # maybe we are in a repository proc = subprocess . Popen ( 'git rev-parse --short HEAD' . split ( ' ' ) , stdout = subprocess . PIPE , stderr = subprocess . PIPE , cwd = pkg_path ) repo_commit , _ = proc . communicate ( ) if repo_commit : return 'repository' , repo_commit . strip ( ) . decode ( 'ascii' ) return '(none found)' , '<not found>'