如何将 Xcode 5 项目的工作副本与死机的 SVN 服务器解除关联

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20846210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:29:05  来源:igfitidea点击:

How to disassociate working copy of an Xcode 5 project from SVN server that died

xcodegitsvn

提问by StillAtWork

I have a modified working copy of an Xcode 5 project that was checked out from a remote svn server that is no longer available. How can I remove the working copy's svn association and have it not be under source control? (Eventually I want to create a git repository based on the working copy and push modifications to it.) I don't need to retain the svn history.

我有一个 Xcode 5 项目的修改工作副本,该副本从不再可用的远程 svn 服务器检出。如何删除工作副本的 svn 关联并使其不受源代码控制?(最终我想基于工作副本创建一个 git 存储库并将修改推送到它。)我不需要保留 svn 历史记录。

I've tried the obvious things to disassociate the svn server from the project (such as deleting the .svn directories in the working copy as well as doing a grep -rsearch on the svn server's name through all the files in the working copy directory tree), but the project remains associated with the svn server. I'd prefer to do this switch directly with the working copy, rather than risking trying to create an empty "working copy" that is not associated with the svn server and then transferring files one-by-one from the current copy. Tools like svn-git aren't feasible as both the svn server isn't available and my working copy contains significant modifications. Help...?

我已经尝试了显而易见的事情来将 svn 服务器与项目分离(例如删除工作副本中的 .svn 目录以及grep -r通过工作副本目录树中的所有文件搜索 svn 服务器的名称),但该项目仍然与 svn 服务器相关联。我更愿意直接使用工作副本进行此切换,而不是冒险尝试创建一个与 svn 服务器无关的空“工作副本”,然后从当前副本一个一个地传输文件。像 svn-git 这样的工具不可行,因为 svn 服务器不可用而且我的工作副本包含重大修改。帮助...?

采纳答案by StillAtWork

I managed to find a way, although probably not the easiest or recommended procedure. Here's what got me to my eventual goal of having the working copy pushed to a remote git server:

我设法找到了一种方法,尽管可能不是最简单或推荐的程序。这就是让我实现将工作副本推送到远程 git 服务器的最终目标的原因:

  1. Remove all SVN information from the working copy by deleting .svn file, etc. (I'd done this before asking my original question.)
  2. Create an empty repository for the project on the remote git server
  3. Add the remote git server in Xcode's Accounts
  4. Close all projects in Xcode and then unselect Enable Source Control in the Xcode Preferences; quit Xcode
  5. Rename the working copy to a temporary name
  6. Launch Xcode, select Enable Source Control, and then checkout the empty repository from the remote git server into a directory with the original working copy name; again disable source control, quit Xcode
  7. Move the .git directory from the checked out (empty) working copy into the original working copy directory (which was renamed in step 5); delete the empty working copy and rename the original working copy back to its original name
  8. Launch Xcode and open the working copy project; the SVN association should be gone
  9. Reenable source control, and the working copy should now be associated with the remote git repository, but with no files added
  10. Open the Utilities inspector and note the tiny Add button in the Source Control area of the Identity and Type pane; click Add to have all the files marked as Added
  11. Commit and push as usual
  1. 通过删除 .svn 文件等从工作副本中删除所有 SVN 信息(我在问我原来的问题之前已经这样做了。)
  2. 在远程 git 服务器上为项目创建一个空仓库
  3. 在 Xcode 的 Accounts 中添加远程 git 服务器
  4. 关闭 Xcode 中的所有项目,然后在 Xcode Preferences 中取消选择 Enable Source Control;退出 Xcode
  5. 将工作副本重命名为临时名称
  6. 启动 Xcode,选择 Enable Source Control,然后从远程 git 服务器检出空仓库到具有原始工作副本名称的目录中;再次禁用源代码控制,退出 Xcode
  7. 将 .git 目录从签出的(空)工作副本移动到原始工作副本目录(在步骤 5 中重命名);删除空的工作副本并将原始工作副本重命名回其原始名称
  8. 启动Xcode并打开工作副本项目;SVN 关联应该消失了
  9. 重新启用源代码控制,工作副本现在应该与远程 git 存储库相关联,但没有添加任何文件
  10. 打开实用工具检查器并注意标识和类型窗格的源代码控制区域中的微小添加按钮;单击添加将所有文件标记为已添加
  11. 像往常一样提交和推送

Voila! My working copy is now under git with a remote git server association. Of course, the SVN history has been lost, but that was not a concern for me. There has to be a shorter recipe, but I wanted to share the above in case it saves anyone in s similar predicament.

瞧!我的工作副本现在位于具有远程 git 服务器关联的 git 下。当然,SVN 历史已经丢失了,但这不是我关心的问题。必须有一个更短的食谱,但我想分享上面的内容,以防万一它拯救任何人处于类似的困境。

回答by wahkiz

I was facing a similar problem just now, I have moved my git from github to gitLabs. However that means the previous repo information is still in my project.

我刚刚面临类似的问题,我已经将我的 git 从 github 移到了 gitLabs。但是,这意味着之前的 repo 信息仍在我的项目中。

So what I discovered was when I have added my gitLab repo into Xcode, SourceTree showed that one file was modified. Surprise, this is the file that keep records of all your Working Copies servers.

所以我发现当我将我的 gitLab 存储库添加到 Xcode 时,SourceTree 显示一个文件被修改。令人惊讶的是,这是保存所有工作副本服务器记录的文件。

Just navigate to "Your Project".xcodeproj > (Right Click & Show Package Contents) > project.xcworkspace > (Right Click & Show Package Contents) > xcSharedData > "Your Project".xccheckout

只需导航到“您的项目”.xcodeproj >(右键单击并显示包内容)> project.xcworkspace >(右键单击并显示包内容)> xcSharedData >“您的项目”.xccheckout

Right Click on the file and select Open with, and click on "More..". Use your preferred Text Editor to edit the XML inside, or you can always use the trusty TextEdit.

右键单击该文件并选择打开方式,然后单击“更多...”。使用您喜欢的文本编辑器来编辑里面的 XML,或者您始终可以使用值得信赖的 TextEdit。

Your old git/svn servers are probably at the bottom, encased in <dict></dict>. Just remove em and reload your project in Xcode.

你的旧 git/svn 服务器可能在底部,包裹在<dict></dict>. 只需删除 em 并在 Xcode 中重新加载您的项目。

回答by Piyush

Remove all unrequited repo from following location

从以下位置删除所有未偿还的回购

DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey

DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey

Checkout all steps Steps

签出所有步骤步骤