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

3

14

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.

Tatianatatianas answered 13/2, 2014 at 18:22 Comment(0)
S
8

No you can't, but you can optimise your local clone. Have a look at my answer to https://mcmap.net/q/832633/-can-i-optimize-a-mercurial-clone.

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

Saliferous answered 13/2, 2014 at 22:31 Comment(1)
Thanks for updating the link to the new location Joshua.Saliferous
H
6

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

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

Hilton answered 14/5, 2015 at 11:24 Comment(2)
This has now been merged into Facebook's hg-ext repository. As of 2017-02-12 remotefilelog is not listed in the main README yet, but there is good documentation in the README within the remotefilelog directory in the source code.Hesione
Broken link. Should probably be: github.com/pycontribs/remotefilelogBunny
G
5

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.

Glogau answered 13/2, 2014 at 19:6 Comment(1)
The firefox repo disagrees with "millions of lines of code and thousands of changesets isn't particularly large". It disagrees to the tune of about 40GB.Aboveboard

© 2022 - 2024 — McMap. All rights reserved.