comparison src/hgext3rd/hggit_serve/_export.py @ 14:959ef686193f

Add user-facing documentation.
author Paul Fisher <paul@pfish.zone>
date Fri, 20 Feb 2026 21:05:31 -0500
parents 00bdfac5416c
children 78ea1ec94be5
comparison
equal deleted inserted replaced
13:00bdfac5416c 14:959ef686193f
149 149
150 # 150 #
151 # Hooks 151 # Hooks
152 # 152 #
153 153
154 _AX_ALWAYS = b'always'
155 _AX_DEFAULT = b'default'
156 _AX_NEVER = b'never'
157
154 158
155 def _export_hook(ui: hgui.ui, repo: hgrepo.IRepo, **__: object) -> None: 159 def _export_hook(ui: hgui.ui, repo: hgrepo.IRepo, **__: object) -> None:
156 """Maybe exports the repository to get after we get new revs.""" 160 """Maybe exports the repository to get after we get new revs."""
157 if not is_gitty(repo): 161 if not is_gitty(repo):
158 return 162 return
159 auto_export = ui.config(b'hggit-serve', b'auto-export') 163 auto_export = ui.config(b'hggit-serve', b'auto-export')
160 if auto_export == b'never': 164 if auto_export == _AX_NEVER:
161 return 165 return
162 if auto_export == b'always' or git_handler.has_gitrepo(repo): 166 if auto_export == _AX_ALWAYS or git_handler.has_gitrepo(repo):
167 if auto_export not in (None, _AX_ALWAYS, _AX_DEFAULT):
168 ui.warn(
169 b'unrecognized auto-export setting %s; using %s',
170 auto_export,
171 _AX_DEFAULT,
172 )
163 if _is_importing(repo): 173 if _is_importing(repo):
164 ui.note(b'currently importing revs from git; not exporting\n') 174 ui.note(b'currently importing revs from git; not exporting\n')
165 return 175 return
166 repo.githandler.export_commits() 176 repo.githandler.export_commits()
167 _fix_refs(ui, repo) 177 _fix_refs(ui, repo)