Commits

Yuya Nishihara committed 97cecf9

serve: get shortname without instantiating thgrepo

Comments (0)

Files changed (1)

tortoisehg/hgqt/serve.py

 from mercurial import extensions, hgweb, util, error
 from mercurial.hgweb import server  # workaround for demandimport
 from tortoisehg.util import paths, wconfig, hglib
-from tortoisehg.hgqt import cmdui, qtlib, thgrepo
+from tortoisehg.hgqt import cmdui, qtlib
 from tortoisehg.hgqt.i18n import _
 from tortoisehg.hgqt.serve_ui import Ui_ServeDialog
 from tortoisehg.hgqt.webconf import WebconfForm
         lui.readconfig(os.path.join(repopath, '.hg', 'hgrc'), repopath)
         c = wconfig.config()
         try:
-            # TODO: not nice to instantiate repo just for repo.shortname
-            repo = thgrepo.repository(None, repopath)
             if not os.path.exists(os.path.join(repopath, '.hgsub')):
                 # no _asconfigliststr(repopath) for now, because ServeDialog
                 # cannot parse it as a list in single-repo mode.
                 c.set('paths', '/', repopath)
             else:
                 # since hg 8cbb59124e67, path entry is parsed as a list
-                base = hglib.fromunicode(repo.shortname)
+                base = lui.config('web', 'name') or os.path.basename(repopath)
                 c.set('paths', base,
                       _asconfigliststr(os.path.join(repopath, '**')))
         except (EnvironmentError, error.Abort, error.RepoError):