《幻影》SVN 存储库中的目录 [英] "Phantom" directories in an SVN repository

查看:34
本文介绍了《幻影》SVN 存储库中的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以某种方式设法使 SVN 存储库进入错误状态.我移动了一个目录,现在我无法在新位置提交它.

svn status而言,目录未知(目录名称为type).

<前>$ svn 状态?类型

当我尝试添加目录时,服务器说它已经存在.

<前>$ svn 添加类型svn: 警告: 'type' 已经在版本控制之下

如果我尝试更新目录,它又消失了.

<前>$ svn 更新类型svn: '.'不受版本控制

如果我尝试提交它,服务器会抱怨它的旧父目录不再存在.

<前>$ svn commit type -m "移动类型"svn:提交失败(详情如下):svn: '/prior/trunk/src/nyu/prior/cvc3/theorem_prover/expression' 找不到路径

更神秘的是,目录的内容被标记为已修改.

<前>$ svn 状态类型A+型M + 类型/IntegerType.javaM+类型/BooleanType.javaM+类型/Type.javaM+类型/RationalRangeType.javaM+类型/RationalType.javaM + 类型/IntegerRangeType.java

如果我尝试从目录中更新,我会得到这个.

<前>$ cd 类型$ svn 更新svn:两个没有目标的顶级报告

从目录内提交会产生与上述相同的 path not found 错误.

发生了什么,我该如何解决?

@Rob Oxspring 发现了我:我在 Eclipse 中移动的东西过于激进.

更新:我接受@Rob Oxspring 的不要那样做/重新开始"的回答并接受他的建议.如果有人能告诉我:(a) 上述错误消息 意味着 的确切含义,以及 (b) 如何实际修复问题,我仍然很感兴趣.

解决方案

在我看来 type 是由某些支持 Subversion 的复制命令创建的,然后使用 Subversion 移动到当前目录中-不知复制.根据我的经验,当包重构操作在 Eclipse 中链接在一起而中间没有提交时,通常会发生这种情况.通常,当您复制/移动本地复制/移动的文件或文件夹时,Subversion 不能很好地处理它,尽管我认为 1.5 版可以更好地处理它.

为了避免将来发生这种情况,请在这些步骤之间提交.如果您想隐藏中间提交,那么我建议您在分支上进行多步重构,然后在您所追求的单次提交中将更改合并回主线.

如果工作量不大,那么我建议您返回一个干净的工作副本并重做您的更改,并在每一步之后提交.如果您很高兴丢失历史记录,即允许新的 IntegerType.java 根本不链接到旧的 IntegerType.java,那么您可以采用这种方法BCS 建议:

  • 将更改的文件移动到某个临时位置,删除所有 .svn 目录
  • 将您的工作副本更新为干净的工作状态
  • 将您的更改复制回您想要的位置
  • 提交生成的工作副本

I've somehow managed to get an SVN repository into a bad state. I've moved a directory and now I can't commit it in its new location.

As far as svn status is concerned, the directory is unknown (the name of the directory is type).

$ svn status
?      type

When I try to add the directory, the server says it already exists.

$ svn add type
svn: warning: 'type' is already under version control

If I try to update the directory, it's gone again.

$ svn update type
svn: '.' is not under version control

If I try to commit it, the server complains that it's old parent directory no longer exists.

$ svn commit type -m "Moving type"
svn: Commit failed (details follow):
svn: '/prior/trunk/src/nyu/prior/cvc3/theorem_prover/expression' path not found

To add to the mystery, the contents of the directory are marked as modified.

$ svn status type
A  +   type
M  +   type/IntegerType.java
M  +   type/BooleanType.java
M  +   type/Type.java
M  +   type/RationalRangeType.java
M  +   type/RationalType.java
M  +   type/IntegerRangeType.java

If I try to update from within the directory, I get this.

$ cd type
$ svn update
svn: Two top-level reports with no target

Committing from within the directory gives the same path not found error as above.

What's going on and how do I fix it?

EDIT: @Rob Oxspring caught me out: I got too aggressive moving things around in Eclipse.

UPDATE: I'm accepting @Rob Oxspring's answer of "don't do that/just start over" and taking his advice. I'd still be interested if anybody could tell me: (a) what the above error messages mean precisely and (b) how to actually fix the problem.

解决方案

It looks to me like type was created by some Subversion-aware copy command, then moved into the current directory using a Subversion-unaware copy. In my experience, this sort of thing typically occurs when package refactoring operations have been chained together in Eclipse without commits in between. Typically, Subversion doesn't handle it well when you copy/move a locally copied/moved file or folder, although I think version 1.5 may handle it better.

To avoid this in the future, commit between such steps. If you'd like to hide the intervening commits then I'd recommend doing the multi-step refactoring on a branch and then merging the changes back into the mainline in that single commit you were after.

If it's not too much work, then I'd recommend getting back to a clean working copy and redoing your changes, committing after each step. If you're happy to lose the history, i.e. allowing the new IntegerType.java to not be linked at all to the old IntegerType.java, then you could take the approach suggested by BCS:

  • Move your changed files into some temporary location, stripping out any .svn directories
  • Update your working copy into a clean working state
  • Copy your changes back to where you want them to be
  • Commit the resulting working copy

这篇关于《幻影》SVN 存储库中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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