将重命名文件和文件夹的历史导入到版本控制 [英] Import history from renamed files and folders to version control

查看:174
本文介绍了将重命名文件和文件夹的历史导入到版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户雇用我来执行使用Mercurial的版本控制,为他15岁的应用程序。但也希望将整个历史记录加载到Mercurial服务器上,但目前没有版本控制软件,只是将其更改日期的文件重命名,如program1.c到program1_20060917.c和program1 copy(1).c,以及旧文件夹与所有文件(另一版本),如folder_20080419。

我想通过文件导入文件作为改变,但计数超过2K提交,他他不同意这样做。



他同意协调将文件分组,但我找不到这样做。



也许如果我可以加载到SVN,Git或CVS,那么我可以将它转换为Mercurial。



有谁知道可能是什么使用还是完成?

解决方案


他同意协调将文件分组, t找到要做的事情


无论如何,此任务的初步阶段是纯手工:with只有(例如)三个状态S1,S2,S3没有附加信息,不可能创建正确的DAG - 它是S1 - > S2 - > S3或S1 - > S3 - > S2或...



您必须按顺序(按时间顺序)列出更改。每个更改可以是整个文件夹或只有文件。



最早的设置将在存储库中首次更改。



对于每个下一个更改集,您都有:如果单个文件复制到存储库中,请小心重命名单独的文件(当您将已重命名的文件与已存在的原始文件一起添加时,的文件夹在这方面更易于管理;在整个文件夹中删除工作目录的所有旧内容(除 .hg 目录之外的所有内容),并从changeset-folder中添加新的文件。



替换后(两种类型) hg status -A 会显示工作目录的状态(纯粹 M 不需要额外的技巧,可能也需要 M + A - 咨询作者,混合 A + D 可能是重命名的结果,必须准确处理) p>

hg addremove --dry-run 将尝试收集(并显示)此变更集处的变更,添加新的,忘记删除)。如果重命名某些版本化文件,则必须使用addremove的 -s 选项修复此信息,以便同时进行编辑和重命名:拾取相似性百分比(-s选项的参数)手动获取正确的结果



由于设置为 hg addremove (实际操作,不带--dry - 运行)你将得到工作目录,准备好 hg commit 并重复下一个更改集的过程,直到它们的完整固定

PS SVN根本不会帮你完成重命名(重命名仍然是Subversion的弱点),Git是比Mercurial更糟糕的选择 - 在Mercurial中你可以处理和修复 addremove -s 错误时的逻辑,Git盲目地在场景后面执行(并且在提交时,如果错误必须修复历史)


I have a client that hired me to implement version control using Mercurial, for his fifteen year old application. But also wants to have the whole history loaded to Mercurial server, but there is no version control software currently, only renamed files with the date they were changed, like program1.c to program1_20060917.c and program1 copy (1).c, and old folders with all the files (another version), like folder_20080419.

I thought of importing file by file as a change, but the count goes over 2K commits, and he doesn't want it like that.

He agrees to reconcile to group the files in changes but I couldn't find something to do it.

Maybe if I could loaded into SVN, Git or CVS, then I could convert it to Mercurial.

Does anyone knows what could be used or done? Thanks in advance.

解决方案

He agrees to reconcile to group the files in changes but I couldn't find something to do it

In any case preliminary stage of this task is only pure handwork: with only (for example) three states S1, S2, S3 without additional information it is not possible to create correct DAG - it is S1 -> S2 -> S3 or S1 -> S3 -> S2 or ...

You have to have ordered (chronologically) list of changes. Each change can be the whole folder or only file(s).

Oldest set will be first changeset in repository.

For every next changeset you have: in case or individual file(s) copy into repository, be careful with renamed separate files (when you add renamed file alongside the already existing original you'll get bad days for restoring), slices of folders are more manageable in this aspect; in case of the whole folder remove all old content of working dir (all the except .hg directory) and add new from changeset-folder

After replacement (both types) hg status -A will show you the sate of working directory with your changes (pure M will not require additional tricks, M+A probably also - consult with author, mix of A+D may be result of renames and must be handled with accuracy)

hg addremove --dry-run will try to collect (and show) changes at this changeset, compared to previous (add new, forget deleted). In case of renaming of some versioned files you have to repair this information using -s option of addremove, for simultaneous editing and renaming: picking similarity percentage (parameter of -s option) by hand for getting correct results

As result of set for hg addremove (real operations, without without --dry-run) you'll get working dir, ready to hg commit and repeating process with next changeset untill to their complete fixation

PS: SVN will not help you with renames at all (renames still are weak point of Subversion), Git is a lot worse choice, than Mercurial - in Mercurial you can handle and fix logic in case of errors for addremove -s, Git perform all blindly behind the scene (and at commit time, in case of error you'll have to fix history)

这篇关于将重命名文件和文件夹的历史导入到版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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