推送大文件存储时 Mercurial 服务器出错

推送大文件存储时 Mercurial 服务器出错

我有较旧的 Debian Jessie 服务器,其中装有 Mercurial 3.1.2 和 Phabricator。长期以来,Phabricator 一直抱怨 HG 太旧,存在安全问题,因此我决定使用最新的 HG 制作全新的 VM。旧版:

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.11 (jessie)
Release:        8.11
Codename:       jessie

hg version
Mercurial Distributed SCM (version 3.1.2)
(see http://mercurial.selenic.com for more information)

新的:

Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
 hg version
Mercurial Distributed SCM (version 4.8.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2018 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enabled extensions:

  largefiles  internal

并配置:

hg debuginstall
checking encoding (UTF-8)...
checking Python executable (/usr/bin/python2)
checking Python version (2.7.16)
checking Python lib (/usr/lib/python2.7)...
checking Python security support (sni,tls1.0,tls1.1,tls1.2)
checking Mercurial version (4.8.2)
checking Mercurial custom build ()
checking module policy (c)
checking installed modules (/usr/lib/python2.7/dist-packages/mercurial)...
checking registered compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines for wire protocol (zstd, zlib, bz2, none)
checking "re2" regexp engine (missing)
checking templates (/usr/share/mercurial/templates)...
checking default template (/usr/share/mercurial/templates/map-cmdline.default)
checking commit editor... (sensible-editor)
checking username (myuser <[email protected]>)
no problems detected


 hg --debug showconfig
starting pager for command 'config'
read config from: /usr/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc.d/cacerts.rc
read config from: /etc/mercurial/hgrc.d/hgext.rc
read config from: /root/.hgrc
read config from: /root/.config/hg/hgrc
/etc/mercurial/hgrc:9: extensions.largefiles=
/etc/mercurial/hgrc:19: trusted.users=root, topperl, www-data
/etc/mercurial/hgrc:12: ui.username=myuser <[email protected]>
--verbose: ui.verbose=False
--debug: ui.debug=True
--quiet: ui.quiet=False
pager: ui.formatted=True
pager: ui.interactive=False
/etc/mercurial/hgrc.d/cacerts.rc:4: web.cacerts=/etc/ssl/certs/ca-certificates.crt

对所有存储库进行 Rsynced,并将 hgweb.wsgi 设置为 Web 服务器(Apache2 vhost,对我来说很容易)

# An example WSGI for use with mod_wsgi, edit as necessary
# See https://mercurial-scm.org/wiki/modwsgi for more information

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/www/vhost/hg/cgi-bin/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

# enable demandloading to reduce startup time
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir

import os
os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb import hgweb
application = hgweb(config)

Python版本是:

Python 2.7.16 (default, Apr  6 2019, 01:42:57)
[GCC 8.3.0] on linux2

当推送大文件时我收到错误:

mod_wsgi (pid=3945): Exception occurred processing WSGI script '/var/www/vhost/hg/cgi-bin/hgwebdir.w

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgwebdir_mod.py", line 352, in run_wsgi
    for r in self._runwsgi(req, res):
  File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 307, in run_wsgi
    for r in self._runwsgi(req, res, repo):
  File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 333, in _runwsgi
    rctx, req, res, self.check_perm)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 221, in handlewsgireque

    _callhttp(repo, req, res, proto, cmd)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 436, in _callhttp
    rsp = wireprotov1server.dispatch(repo, proto, cmd)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 74, in dispatch
    return func(repo, proto, *args)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 196, in batch
    result = func(repo, proto, *[data[k] for k in keys])
  File "/usr/lib/python2.7/dist-packages/hgext/largefiles/proto.py", line 89, in statlfile
    filename = lfutil.findfile(repo, sha)
  File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 111, in findfile
    elif inusercache(repo.ui, hash):
  File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 100, in inusercache
    path = usercachepath(ui, hash)
  File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 71, in usercachepath
    return os.path.join(_usercachedir(ui), hash)
  File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 97, in _usercachedir
    raise error.Abort(_('unknown %s usercache location') % name)
Abort: unknown largefiles usercache location

我整天都在努力尝试,也尝试了各种调整和建议,但是都没有成功 :/

有人能提供一些建议吗?

PS:还尝试克隆旧的>>推送新的一些存储库,但仍然不行

答案1

部分解决问题 - 用户克隆的存储库现在可以hg push repo 添加到 /etc/mercurial/hgrc,但以下情况除外:

[extensions]
largefiles =

[largefiles]
usercache = /path/to/largefiles/storage

仍然面临如何将所有转发从旧服务器迁移到新服务器的问题。如果我找到合适的解决方案,我会编辑主题。

相关内容