1

I'm interesting in reducing the size of .hg folder in my project. I have size of .hg folder near 180Mb, but the real sources size of project is near 6Mb. So, I need some ways to downscale size of .hg folder.
In Mercurial history, there are a lot of bin, image files.

I searched some ways to solve this problem, but this is not exactly what I need. I needn't remove specific file, I need to remove all commits, so, in example:

0....1360 commits. With in more than 150Mb, and 6Mb real sources. I need similar to use 0...(1~50) commits and near 10Mb of real sources. This is cloned repositary, but I want to save all history in my server. So, the cloned repo with 10 commits need's to be related with server repo with 1360 commits. Any ways?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
libbkmz
  • 641
  • 1
  • 7
  • 17
  • I think this is a duplicate of [this question](http://stackoverflow.com/questions/2684898/mercurial-remove-history). The bigger question is why would you ever want to do this? It invalidates the entire history. – Sumo Jul 12 '11 at 03:20
  • I already read this. But it isn't what I need. It was the first time I've ever used Mercurial and all of VCS, and to use in some production cases I want to try remove unusable data. – libbkmz Jul 12 '11 at 03:23
  • Then, I don't think you fully understand how Mercurial works, then. History is all you have and each commit is pretty much a diff of the previous (a very simplistic view). If you want something for production, you can clone the repository and then just delete the .hg folder. – Sumo Jul 12 '11 at 03:30
  • But how can I add changes to it? Now, I used push to this folder and thats all. But I don't want to abandon this ) – libbkmz Jul 12 '11 at 03:32
  • Then, you can't delete the .hg folder. If you want to continue to use it as an easy way to ensure what is on the server in this folder is the same as what is in version control, then there is no solution to removing the extra files/data unless you delete everything in the folder, re-clone the repository, and delete the .hg folder. – Sumo Jul 12 '11 at 03:51

1 Answers1

1

It sounds like you have both source code and your binaries committed to the repository. One option is to create a second repository for only "published/compiled" code and remove anything compiled from the first repository. Use the new repository for deploying updated code to your server. This should come with a smaller .hg folder on the server.

Either way, you cannot "remove" history without actually losing it with a DVCS. You have the option of completely deleting the .hg folder, but if you want to use Mercurial to update that folder and keep things in sync with what the latest changes are in the repository, you'll need to keep that folder around.

Sumo
  • 4,066
  • 23
  • 40