Get the head commit.

        :return: Commit of the head commit
190525
def get_head(self) -> Commit:
        
        head_commit = self.repo.head.commit
        return Commit(head_commit, self.path, self.main_branch)
970477
def commit(self):
        
        self._check_state()

        database = self._session._database
        api = database.spanner_api
        metadata = _metadata_with_prefix(database.name)
        response = api.commit(
            self._session.name,
            self._mutations,
            transaction_id=self._transaction_id,
            metadata=metadata,
        )
        self.committed = _pb_timestamp_to_datetime(response.commit_timestamp)
        del self._session._transaction
        return self.committed
681985
def sethead(self, ref):
        """"""
        log.debug('[%s] Setting to ref %s', self.name, ref)
        try:
            ref = self.repo.rev_parse(ref)
        except gitdb.exc.BadObject:
            # Probably means we don't have it cached yet.
            # So maybe we can fetch it.
            ref = self.fetchref(ref)
        log.debug('[%s] Setting head to %s', self.name, ref)
        self.repo.head.reset(ref, working_tree=True)
        log.debug('[%s] Head object: %s', self.name, self.currenthead)
1312464
def get_stats_commit_activity(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/stats/commit_activity"
        )
        if not data:
            return None
        else:
            return [
                github.StatsCommitActivity.StatsCommitActivity(self._requester, headers, attributes, completed=True)
                for attributes in data
            ]
303349
def commit_hash(dir='.'):
    

    cmd = ['git', 'rev-parse', 'HEAD']

    try:
        with open(os.devnull, 'w') as devnull:
            revision_hash = subprocess.check_output(
                cmd,
                cwd=dir,
                stderr=devnull
            )
        if sys.version_info.major > 2:
            revision_hash = revision_hash.decode('ascii')

        return revision_hash.strip()

    except subprocess.CalledProcessError:
        return None
328459
def _get_head_block(self):
        
        if not self.head_block_header:
            block_hash = self.db.get(head_header_key)
            num = self._get_block_number(block_hash)
            self.head_block_header = self._get_block_header(block_hash, num)
            # find header with valid state
            while (
                not self.db.get(self.head_block_header.state_root)
                and self.head_block_header.prevhash is not None
            ):
                block_hash = self.head_block_header.prevhash
                num = self._get_block_number(block_hash)
                self.head_block_header = self._get_block_header(block_hash, num)

        return self.head_block_header
604696
def get_commits(self):
        
        return github.PaginatedList.PaginatedList(
            github.Commit.Commit,
            self._requester,
            self.url + "/commits",
            None
        )
430692
def _get_headnode_dict(fixer_list):
    
    head_nodes = collections.defaultdict(list)
    every = []
    for fixer in fixer_list:
        if fixer.pattern:
            try:
                heads = _get_head_types(fixer.pattern)
            except _EveryNode:
                every.append(fixer)
            else:
                for node_type in heads:
                    head_nodes[node_type].append(fixer)
        else:
            if fixer._accept_type is not None:
                head_nodes[fixer._accept_type].append(fixer)
            else:
                every.append(fixer)
    for node_type in chain(pygram.python_grammar.symbol2number.itervalues(),
                           pygram.python_grammar.tokens):
        head_nodes[node_type].extend(every)
    return dict(head_nodes)
35478
def get_new_version(self, last_version, last_commit,
                        diff_to_increase_ratio):
        

        version = Version(last_version)
        diff = self.get_diff(last_commit, self.get_last_commit_hash())
        total_changed = diff[Diff.ADD] + diff[Diff.DEL]

        version.increase_by_changes(total_changed, diff_to_increase_ratio)
        return version
183178
def get_current_branch():
    
    cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
    return output.strip().decode("utf-8")
635860
def get_current_head(graph):
    
    session = new_session(graph)
    try:
        result = session.execute("SELECT version_num FROM alembic_version")
    except ProgrammingError:
        return None
    else:
        return result.scalar()
    finally:
        session.close()
1307074
def get_commits(self, path, follow=False):
        '''
        
        '''
        if follow:
            return self.get_commits_following(path)
        else:
            return self._get_commits(path)
1284702
def _commitData(self, commit):
		
		return {
			"hexsha": commit.hexsha,
			"adate": commit.authored_date,
			"cdate": commit.committed_date,
			"author": "%s <%s>" % (commit.author.name, commit.author.email),
			"message": commit.message
		}
1194717
def get_commits(self, since_sha=None):
        
        assert self.tempdir

        cmd = ['git', 'log', '--first-parent', '--reverse', COMMIT_FORMAT]
        if since_sha:
            commits = [self.get_commit(since_sha)]
            cmd.append('{}..HEAD'.format(since_sha))
        else:
            commits = []
            cmd.append('HEAD')

        output = cmd_output(*cmd, cwd=self.tempdir)

        for sha, date in chunk_iter(output.splitlines(), 2):
            commits.append(Commit(sha, int(date)))

        return commits
1171601
def get_last_commit_message(self):
        
        # Check if we are currently in a repo
        try:
            branch = self.active_branch
            return self.commit(branch).message
        except InvalidGitRepositoryError:
            print "Not in a git repo"
            return None
1178596
def get_commit_log(from_rev=None):
    

    check_repo()
    rev = None
    if from_rev:
        rev = '...{from_rev}'.format(from_rev=from_rev)
    for commit in repo.iter_commits(rev):
        yield (commit.hexsha, commit.message)
1351338
def get_revision():
	
	git_bin = smoke_zephyr.utilities.which('git')
	if not git_bin:
		return None
	proc_h = subprocess.Popen(
		(git_bin, 'rev-parse', 'HEAD'),
		stdout=subprocess.PIPE,
		stderr=subprocess.PIPE,
		close_fds=True,
		cwd=os.path.dirname(os.path.abspath(__file__))
	)
	rev = proc_h.stdout.read().strip()
	proc_h.wait()
	if not len(rev):
		return None
	return rev.decode('utf-8')