def expand_branch_name(self, name):
<EOL>if not name:<EOL><INDENT>return self.default_revision<EOL><DEDENT>branches = list(self.find_branches_raw())<EOL>for prefix, other_name, revision_id in branches:<EOL><INDENT>if prefix == '<STR_LIT>' and name == other_name:<EOL><INDENT>logger.debug("<STR_LIT>", name)<EOL>return name<EOL><DEDENT><DEDENT>for prefix, other_name, revision_id in branches:<EOL><INDENT>if prefix.startswith('<STR_LIT>') and name == other_name:<EOL><INDENT>unambiguous_name = prefix + name<EOL>logger.debug("<STR_LIT>", name, unambiguous_name)<EOL>return unambiguous_name<EOL><DEDENT><DEDENT>logger.debug("<STR_LIT>", name)<EOL>return name<EOL>
Expand branch names to their unambiguous form.

:param name: The name of a local or remote branch (a string).
:returns: The unambiguous form of the branch name (a string).

This internal method is used by methods like :func:`find_revision_id()`
and :func:`find_revision_number()` to detect and expand remote branch
names into their unambiguous form which is accepted by commands like
``git rev-parse`` and ``git rev-list --count``.