帮助我处理 Mercurial 扩展导出文件

发布于 2024-11-25 06:22:43 字数 1350 浏览 2 评论 0原文

我正在尝试使用 Mercurial 的 exportfiles 扩展名,但出现此错误:

c:\xampp\htdocs\dev>hg exportfiles -r 1 /tmp/export
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 1.9+10-e9264b45237d)
** Extensions loaded: exportfiles
Traceback (most recent call last):
  File "hg", line 42, in <module>
  File "mercurial\dispatch.pyo", line 27, in run
  File "mercurial\dispatch.pyo", line 64, in dispatch
  File "mercurial\dispatch.pyo", line 87, in _runcatch
  File "mercurial\dispatch.pyo", line 675, in _dispatch
  File "mercurial\dispatch.pyo", line 454, in runcommand
  File "mercurial\dispatch.pyo", line 729, in _runcommand
  File "mercurial\dispatch.pyo", line 683, in checkargs
  File "mercurial\dispatch.pyo", line 672, in <lambda>
  File "mercurial\util.pyo", line 385, in check
  File "C:\Users\Sasa/exportfiles.py", line 39, in exportfiles
    rng = cmdutil.revrange(repo, opts['rev'])
AttributeError: 'module' object has no attribute 'revrange'

我正在使用TortiseHG 2.1.1 for Windows 32-bit with Mercurial 1.9+10

你能帮我解决这个问题并使用exportfiles扩展吗?

提前致谢!

i'm trying to use exportfiles extension for mercurial but I'm getting this error:

c:\xampp\htdocs\dev>hg exportfiles -r 1 /tmp/export
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 1.9+10-e9264b45237d)
** Extensions loaded: exportfiles
Traceback (most recent call last):
  File "hg", line 42, in <module>
  File "mercurial\dispatch.pyo", line 27, in run
  File "mercurial\dispatch.pyo", line 64, in dispatch
  File "mercurial\dispatch.pyo", line 87, in _runcatch
  File "mercurial\dispatch.pyo", line 675, in _dispatch
  File "mercurial\dispatch.pyo", line 454, in runcommand
  File "mercurial\dispatch.pyo", line 729, in _runcommand
  File "mercurial\dispatch.pyo", line 683, in checkargs
  File "mercurial\dispatch.pyo", line 672, in <lambda>
  File "mercurial\util.pyo", line 385, in check
  File "C:\Users\Sasa/exportfiles.py", line 39, in exportfiles
    rng = cmdutil.revrange(repo, opts['rev'])
AttributeError: 'module' object has no attribute 'revrange'

I'm using TortiseHG 2.1.1 for Windows 32-bit with Mercurial 1.9+10

Could you help me please to solve this and use exportfiles extension?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

左耳近心 2024-12-02 06:22:43

Mercurial 的 API 在版本 1.8 后发生了更改。

各种函数已从 cmdutil.py 移至 scmutil.py,
包括 revrange/revsingle/revpair 和 match/matchall/matchfiles

假设这个是您正在使用的扩展的源,第 11 行应该是

from mercurial import util, scmutil

,第 39 行应该是

rng = scmutil.revrange(repo, opts['rev'])

Mercurial's API changed after version 1.8.

Various functions have been moved from cmdutil.py to scmutil.py,
including revrange/revsingle/revpair and match/matchall/matchfiles

Assuming this is the source of the extension you're using, line 11 should be

from mercurial import util, scmutil

and line 39 should be

rng = scmutil.revrange(repo, opts['rev'])
因为看清所以看轻 2024-12-02 06:22:43

Mercurial 的内部结构可能发生了一些变化,并且扩展需要更新,但我并不完全认为出了问题。 cmdutil 似乎有一个 revrange 方法。 注意:我看到 cmdutil 源代码的地方> 显然是一个过时的分支。

但是,在有人加入修复扩展之前,有一个解决方法至少可以获取添加或修改的文件列表。您可以转换输出或将其提供给您自己的脚本,以便复制正确的文件:

hg status --rev 100:110 --added --modified

这列出了从修订版 100 到修订版 110 添加或修改的文件(您不能使用 -r 作为--rev 的缩短开关,它是 --removed 的缩写)。输出在每个相对路径之前都有一个 MA

It's possible that Mercurial's internals have changed a bit and the extension needs to be updated, however I'm not entirely what's wrong. cmdutil does seem to have a revrange method. NB: The place where I saw the source for cmdutil was evidently an out-of-date fork.

However, until someone chimes in with a fix to the extension, there is a workaround for at least getting a list of files added or modified. You can transform the output or feed it to your own script in order to get the right files copied:

hg status --rev 100:110 --added --modified

This lists files added or modified from revision 100 to revision 110 (you can't use -r as a shortened switch of --rev, it's short for --removed). The output has a M or A before each relative path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文