hg rename 不会删除工作副本中的原始文件夹

发布于 2024-10-20 16:14:37 字数 335 浏览 1 评论 0原文

我在 Mercurial 存储库中有一个名为 httpdocs/css/ui-lightness 的目录。我想将此目录及其所有内容移至 httpdocs/css/jquery/themes/ui-lightness。所以,我认为这是启动命令:

hg rename httpdocs/css/ui-lightness httpdocs/css/jquery/themes/ui-lightness

事实上,我已经尝试过并且它似乎可以工作,除了在工作副本中“源”目录(即 httpdocs/css/ui-lightness)不是已删除(在存储库中时)。

有人可以解释为什么吗?

I've a directory in Mercurial repository called httpdocs/css/ui-lightness. I want to move this directory and all its contents to httpdocs/css/jquery/themes/ui-lightness. So, I think this is the command to launch:

hg rename httpdocs/css/ui-lightness httpdocs/css/jquery/themes/ui-lightness

In fact, I've already tried and it seems to work, except that in the working copy the "source" directory (that is, httpdocs/css/ui-lightness) is NOT deleted (while in the repository it is).

Can someone explain why?

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

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

发布评论

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

评论(3

简单气质女生网名 2024-10-27 16:14:37

Krtek 发现,您所做的应该有效。这是我在本地运行的情况:

~$ mkdir -p httpdocs/css/ui-lightness
~$ cd httpdocs/
~/httpdocs$ hg init
~/httpdocs$ echo test > css/ui-lightness/file
~/httpdocs$ hg commit -A -m "initial commit, old location"
adding css/ui-lightness/file
~/httpdocs$ hg rename css/ui-lightness css/jquery/themes/ui-lightness
moving css/ui-lightness/file to css/jquery/themes/ui-lightness/file
~/httpdocs$ ;s
bash: syntax error near unexpected token `;'
~/httpdocs$ ls
css
~/httpdocs$ tree
.
`-- css
    `-- jquery
        `-- themes
            `-- ui-lightness
                `-- file

4 directories, 1 file
~/httpdocs$ hg stat
A css/jquery/themes/ui-lightness/file
R css/ui-lightness/file

如果 httpdocs/css/ui-lightness 中有任何未跟踪(可能被忽略)的文件,它们将不会被重命名,因此该目录不会为空,因此不会被删除,但应该移动该目录中的跟踪内容。

请注意,我还没有提交该重命名(即使 Mercurial 知道它是重命名,它也会显示为“添加”和“删除”),但为了使其反映在其他克隆中,我需要 hg commit 、hg Push,他们必须hg pull,然后hg updatehg merge >。

A Krtek found, what you're doing should work. Here's me running it locally:

~$ mkdir -p httpdocs/css/ui-lightness
~$ cd httpdocs/
~/httpdocs$ hg init
~/httpdocs$ echo test > css/ui-lightness/file
~/httpdocs$ hg commit -A -m "initial commit, old location"
adding css/ui-lightness/file
~/httpdocs$ hg rename css/ui-lightness css/jquery/themes/ui-lightness
moving css/ui-lightness/file to css/jquery/themes/ui-lightness/file
~/httpdocs$ ;s
bash: syntax error near unexpected token `;'
~/httpdocs$ ls
css
~/httpdocs$ tree
.
`-- css
    `-- jquery
        `-- themes
            `-- ui-lightness
                `-- file

4 directories, 1 file
~/httpdocs$ hg stat
A css/jquery/themes/ui-lightness/file
R css/ui-lightness/file

If you have any untracked (possibly ignored) files in httpdocs/css/ui-lightness they won't be renamed and thus the directory won't be empty and thus not removed, but the tracked contents in that directory should be moved.

Notice I've not yet committed that rename (and that it shows up as an Add and a Remove even though Mercurial knows it's a rename), but for it to be reflected in other clones, I'd need to hg commit, hg push and they'd have to hg pull and then either hg update or hg merge.

别把无礼当个性 2024-10-27 16:14:37

您如何称呼“存储库”和“工作副本”?您在哪里执行 hg rename 命令?

我认为您只是忘记将更改推送到一侧,然后在另一侧进行拉动。更改不会神奇地出现在存储库的所有克隆中,您必须检索更改。

我刚刚测试过,hg rename 可以很好地删除文件。

What are you calling the "repository" and the "working copy" and where do you do your hg rename command ?

I think you just forgot to push your changes on one side and then do a pull on the other side. Changes won't magically appear in all the clones of your repository, you must retrieve the changes.

I just tested, hg rename removes the files just fine.

蓝眼睛不忧郁 2024-10-27 16:14:37

它不会删除源,只是将其标记为在存储库中删除。之后您应该手动删除文件。

It does not delete the source, it just marks it for removal in the repository. You should remove files by hands afterwards.

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