Can I clone just the latest changesets of a repository instead of the entire history?

南笙酒味 提交于 2019-12-30 04:00:05

问题


I have to work with an hg repository that has millions of lines of code and hundreds of thousands of changesets. As you can imagine, this really slows down mercurial and TortoiseHg.

Is it possible for me to create a local repository that only has the latest few thousand changesets?

Not only would this hopefully make things run snappier, but it might also save me some hard drive space.


回答1:


No you can't, but you can optimise your local clone. Have a look at my answer to https://stackoverflow.com/a/19294645/479199.

There has been some work on shallow clones, but it's still very much a work in progress (and there doesn't seem to have been much progress):

https://www.mercurial-scm.org/wiki/ShallowClone




回答2:


It seems that Facebook released an extension that is supposed to solve this problem.

See https://bitbucket.org/facebook/remotefilelog




回答3:


No you can't. That's called a "Shallow Clone" and it's not implemented/supported. Millions of lines of code and thousands of changesets isn't particularly large, and once you've cloned it down once almost every action should be near instantaneous.

Further, the compressed binary deltas in the .hg directory are usually smaller than the entirety of the uncompressed code in the working directory, so the space savings shouldn't be substantial either.

Once you've cloned the repo once, make sure to do any further clones on the same machine from your local clone, and you'll never have to wait for the whole repo to clone again.



来源:https://stackoverflow.com/questions/21762447/can-i-clone-just-the-latest-changesets-of-a-repository-instead-of-the-entire-his

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!