diego.martinez
diego.martinez

Reputation: 1051

Create new mercurial repository cloning SINCE revision

I have a HUGE mercurial repository.

Cloning and some operations are starting to be slow. I would like to get rid of old commits, but keep the history of revisions since a specific date.

Is there any way to keep the commits SINCE a specific commit on a single branch, and collapse all the older parent commits in a single one?

R1 -> R2 ->R3 ->R4 ->R5 -> R6 -> R7 ->R8 ->Tip

[R1-5] ->R6 ->R7 ->R8 ->Tip

I tried to do such thing using GRAFT, but it did not work (maybe I don't now how to do it properly).

Optional: Is there such an option on Sourcetree?

Upvotes: 2

Views: 94

Answers (1)

planetmaker
planetmaker

Reputation: 6044

You cannot clone it to achieve this. But you have basically two options:

  1. history rewrite using histedit (it's an default extension, but needs enabling) It gives you the option to fold commits, that is combine several one to a single.

  2. convert (which in essence is also a history rewrite) This gives you the chance to create a new repository with only the selected commits and branches. Thus you can simply leave out the first 4 commits and start with the 5th.

For each also checkout the help shipped with mercurial (hg help histedit, hg help convert).

Upvotes: 1

Related Questions