Mercurial > hg-git-serve
diff src/hgext3rd/hggit_serve/_export.py @ 20:84dfbee2ced6
Fix error messages and default branch handling in git export.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Mon, 23 Feb 2026 17:12:20 -0500 |
| parents | 78ea1ec94be5 |
| children |
line wrap: on
line diff
--- a/src/hgext3rd/hggit_serve/_export.py Mon Feb 23 17:12:03 2026 -0500 +++ b/src/hgext3rd/hggit_serve/_export.py Mon Feb 23 17:12:20 2026 -0500 @@ -118,14 +118,16 @@ try: hgnode = repo.branchtip(branch) except hgerr.RepoLookupError: - # This branch somehow doesn't exist??? - ui.warn(f"{branch!r} doesn't seem to exist?".encode()) - return + # The default branch may not exist. + if branch != b'default': + ui.warn(f"{branch!r} doesn't seem to exist?\n".encode()) + return + hgnode = repo.changelog.tip() hgsha = binascii.hexlify(hgnode) gitsha = repo.githandler.map_git_get(hgsha) if not gitsha: # No Git SHA to match this Hg sha. Give up. - ui.warn(f'revision {hgsha!r} was not exported to Git'.encode()) + ui.warn(f'revision {hgsha!r} was not exported to Git\n'.encode()) return refs = repo.githandler.git.refs refs.add_packed_refs({git_branch: gitsha})
