Skip to content

Commit

Permalink
Allow topics without branch
Browse files Browse the repository at this point in the history
If a topic doesn't have a specified branch, for example "topics/foobar",
the "default" is assumed.

Signed-off-by: Felipe Contreras <[email protected]>
  • Loading branch information
felipec committed May 10, 2023
1 parent 6e4ebbd commit 2219b58
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,10 @@ def parse_commit(parser):
# Check if the ref is supposed to be a named branch
if ref.startswith('refs/heads/topics/'):
branch = ref[len('refs/heads/topics/'):]
branch, topic = branch.split('/', 2)
try:
branch, topic = branch.split('/', 2)
except ValueError:
branch, topic = ('default', branch)
extra[b'topic'] = hgref(topic)
extra[b'branch'] = hgref(branch)
elif ref.startswith('refs/heads/branches/'):
Expand Down

0 comments on commit 2219b58

Please sign in to comment.