gpt4 book ai didi

linux - splinter 的 Mercurial repo

转载 作者:太空宇宙 更新时间:2023-11-04 11:21:46 25 4
gpt4 key购买 nike

我在我的根目录上执行了一个递归 sed,当我尝试提交,或者除了 hg --help 之外用 hg 做任何事情时,我得到了一个堆栈跟踪。当我执行 sed 时,我错误地认为 .hg 目录是写保护的。

repo 在我的机器本地。

我有什么方法可以恢复我的更新日志或提交评论吗?我在 .hg 目录中找到了一个名为 00changelog.i 的文件,但它是一个无法执行的二进制文件。

sed 命令:

find . -type f -exec sed -i.bak "s/sim-config.h/config.h/g" {} \;
find . -type f -exec sed -i.bak "s/av-config.h/config.h/g" {} \;

堆栈跟踪:

Traceback (most recent call last):
File "/usr/bin/hg", line 27, in <module>
mercurial.dispatch.run()
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 16, in run
sys.exit(dispatch(sys.argv[1:]))
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 30, in dispatch
return _runcatch(u, args)
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 50, in _runcatch
return _dispatch(ui, args)
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 470, in _dispatch
return runcommand(lui, repo, cmd, fullargs, ui, options, d)
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 340, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 521, in _runcommand
return checkargs()
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 475, in checkargs
return cmdfunc()
File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 469, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
return func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 712, in commit
node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
File "/usr/lib/python2.6/site-packages/mercurial/cmdutil.py", line 1151, in commit
return commitfunc(ui, repo, message, match(repo, pats, opts), opts)
File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 710, in commitfunc
editor=e, extra=extra)
File "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 787, in commit
changes = self.status(match=match, clean=force)
File "/usr/lib/python2.6/site-packages/mercurial/localrepo.py", line 1015, in status
listclean, listunknown)
File "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 614, in status
dmap = self._map
File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 156, in __get__
result = self.func(obj)
File "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 58, in _map
self._read()
File "/usr/lib/python2.6/site-packages/mercurial/dirstate.py", line 228, in _read
p = parsers.parse_dirstate(self._map, self._copymap, st)

最佳答案

如果您没有上游资源,您可以替换 .hg克隆,这可能取决于文件的困惑程度。然而,正如您所注意到的,Mercurial 以二进制格式在内部存储文件,这使得手动修复变得更加困难。

大概您没有使用 sed -i.bak 运行使用备份进行就地操作(这样可以轻松恢复)。

你可以这样做:

find .hg -mmin -60 -print

查看过去(比如)60 分钟内修改了哪些文件。也许没有太多修改,你可以找到一些方法来扭转 sed 的影响。该文件上的命令(但如果你运行类似 /foo/d 的东西,那将是不可能的)。

为了将来,可能值得在 http://bitbucket.org/ 上注册一个免费帐户。这将为您提供免费的私有(private)存储库托管和良好的备份位置。

关于linux - splinter 的 Mercurial repo ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17750040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com