恢复 .orig 文件的简单方法?

发布于 2024-10-08 11:24:24 字数 91 浏览 0 评论 0原文

我刚刚不小心运行了 hg revert *。 Mercurial 是否附带了将所有 .orig 文件移回原位的工具?

I've just gone and accidentally run hg revert *. Does Mercurial come with a tool to move all the .orig files back into place?

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

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

发布评论

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

评论(3

禾厶谷欠 2024-10-15 11:24:24

不。如果您在 bash 中,您始终可以执行以下操作:

for thefile in *.orig ; do cp -v $thefile ${thefile%%.orig} ; done

No. If you're in bash you can always do:

for thefile in *.orig ; do cp -v $thefile ${thefile%%.orig} ; done
破晓 2024-10-15 11:24:24

此命令将从存储库中的任何位置恢复 .orig 文件:

find `hg root` -name *.orig -exec rename -f 's/.orig//' {} \;

您可以在 .hgrc 中为此添加一个 hg 别名,如下所示:

[alias]
reinstate= !find `$HG root` -name *.orig -exec rename -f 's/.orig//' {} \;

然后使用以下命令从存储库运行它:

hg reinstate

This command will reinstate your .orig files from anywhere inside your repo:

find `hg root` -name *.orig -exec rename -f 's/.orig//' {} \;

You can add a hg alias for this in your .hgrc like so:

[alias]
reinstate= !find `$HG root` -name *.orig -exec rename -f 's/.orig//' {} \;

And then run it from your repo using this command:

hg reinstate
紫﹏色ふ单纯 2024-10-15 11:24:24

否,但您的操作系统可能提供 cp 命令(或等效命令)。只需将 .orig 复制到恢复的文件中,或者,如果您已提交所需版本的文件,请从该版本再次恢复它。

No, but your operating system probably provides cp command (or equivalent). Just copy .orig onto reverted file, or, if you've commited the file in the wanted version, revert it again from that version.

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