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

时间:2011-03-06 10:38:56

标签: mercurial rename

我在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)未被删除(在存储库中它是)。

有人可以解释原因吗?

3 个答案:

答案 0 :(得分:1)

你在说什么叫“存储库”和“工作副本”,你在哪里做hg rename命令?

我认为你只是忘了在一边推动你的改变,然后在另一边做一个拉动。更改不会神奇地出现在存储库的所有克隆中,您必须检索更改。

我刚刚测试过,hg rename删除文件就好了。

答案 1 :(得分:1)

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中有任何未跟踪(可能被忽略)的文件,它们将不会被重命名,因此该目录不会为空,因此不会被删除,但应移动该目录中的跟踪内容。

注意我还没有提交重命名(并且它显示为Add和Remove,即使Mercurial知道它是重命名),但是为了将其反映在其他克隆中,我需要{{ 1}},hg commit他们必须hg push,然后hg pullhg update

答案 2 :(得分:-1)

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

相关问题