在Subversion工作副本中重命名一个目录的合理方式 [英] A sane way to rename a directory in subversion working copy

查看:136
本文介绍了在Subversion工作副本中重命名一个目录的合理方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然以某种方式精通VCS(常规svn,git和git-svn用户),我似乎无法围绕这种特殊的SVN行为。



每当我需要从另一个干净状态重命名SVN工作副本中的一个目录 - 即 svn status 不返回任何内容,所有其他修改已经被提交 - 就像这样(这是svn doc建议什么):

  svn mv foo bar 
svn commit

SVN大声抱怨:

 添加栏
添加栏/ toto
删除foo
svn:提交失败(详细信息):
svn:项目'/ test / foo'已过期

如你所愿:

  svn update 

其中:

  C foo 
在修订版本46.
冲突摘要:
树冲突:1

有一个树冲突,没有发生第三方变更。显然,离开这个树冲突混乱的唯一方法是一般地(从svn红皮书):

  svn resolve  - 接受工作-R。 
svn commit

将其远程重命名在repo上,然后更新我的工作副本似乎很棒:

  url = $(svn info | grep -e'^ URL:'| sed's / ^ URL://' )svn mv $ url / foo $ url / bar 
svn update

是否有制裁,更精简的方式来重命名我失踪的文件夹?这个特别令人惊讶的树冲突状态背后的根本原因是什么?

解决方案

svn mv 为我工作:

  C:\svn\co> svn mv my_dir new_dir 
A new_dir
D my_dir\New Text Document.txt
D my_dir


C:\svn\co> svn commit -m foo
Raderar my_dir
Läggeruntil new_dir

Arkiverade修订版2.

C:\svn\co>

对于svn的瑞典语输出,对不起。



编辑:

正如所指出的那样Lloeki的评论



要重现行为,您还需要更新和提交文件夹中包含的文件,但不会更新文件夹本身。


文件提交在
repo上创建一个新的版本,但本地元数据不是
更新(因为它一直是,在任何提交后看到svn
日志),因此dir
元数据在rev n-1。它符合
,因为
元数据差异,svn不会提交,并且它不会更新
,因为
的确存在冲突:更新元数据vs删除。


行为是预期,解决方案是在发布 svn之前更新工作副本重命名命令。


While somehow versed in VCS (regular svn, git and git-svn user) I can't seem to wrap my head around this peculiar SVN behavior.

Whenever I need to rename a directory in my SVN working copy from an otherwise 'clean' state - i.e svn status returns nothing and all other modifications have been commited - like so (which is what the svn doc suggests):

svn mv foo bar
svn commit

SVN complains loudly:

Adding         bar
Adding         bar/toto
Deleting       foo
svn: Commit failed (details follow):
svn: Item '/test/foo' is out of date

As you wish:

svn update

Which gives:

   C foo
At revision 46.
Summary of conflicts:
  Tree conflicts: 1

There's a tree conflict, while no third-party change happened. Obviously, the only way to get out of this tree conflict mess is generically (from the svn red book):

svn resolve --accept working -R .
svn commit

Renaming it remotely on the repo then updating my working copy seems quite braindead:

url=$(svn info | grep -e '^URL:' | sed 's/^URL: //') svn mv $url/foo $url/bar
svn update

Is there a sanctioned, more streamlined way to rename a folder that I'm missing? What is the root cause behind that particularly surprising tree conflict state?

解决方案

svn mv works for me:

C:\svn\co>svn mv my_dir new_dir
A         new_dir
D         my_dir\New Text Document.txt
D         my_dir


C:\svn\co>svn commit -m foo
Raderar             my_dir
Lägger till         new_dir

Arkiverade revision 2.

C:\svn\co>

Sorry for the Swedish output of svn.

There must be something else that is wrong in your case.

Edit:
As pointed out in the comments by Lloeki

To reproduce the behavior you also need to update and commit a file contained in the folder, but not update the folder itself.

file commit creates a new rev n on the repo, but local metadata is not updated (as it has always be, see svn log after any commit) , thus dir metadata is at rev n-1. It follows that svn won't commit because of the metadata diff, and it won't update because there's indeed a conflict on the dir: update metadata vs delete.

The behavior is "expected" and the "solution" is to update the working copy before issuing the svn rename command.

这篇关于在Subversion工作副本中重命名一个目录的合理方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆