13

ok, when I was young, I put severial big files(like resource file, dll, etc..) in my mercurial repos. and I found the size of it is so big that I cannot easily push it into bitbucket,

any way to delete this files history EASILY?

I put all those files in /res and /dll path.

edit:

this is a solution, but it will delete part of the history, so maybe there is a better solution. Mercurial Remove History

Community
  • 1
  • 1
linjunhalida
  • 4,538
  • 6
  • 44
  • 64

1 Answers1

18

Your best bet is to use the convert extension, but warning you'll end up with a totally different repo. Every hash will be different and every person who cloned will need to delete their clone and re-clone.

That said, here's what you do:

Create a filemap file named filemap.txt containing:

exclude res
exclude dll

and then run this command:

hg convert --filemap filemap.txt your-source-repository your-destination-repository

For example:

hg convert --filemap filemap.txt /home/you/repos/bloatedrepo /home/you/repos/slenderrepo

That gets you a whole new repo that has all of your history except the history of any files in /res and /dll, but again it will be a new, unrelated repo as far as mercurial (and bitbucket) are concerned.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • The convert switch isnt found for some reason has it been removed? – keyoke Mar 23 '11 at 12:19
  • 1
    my bad you have to manually add the following in mercurial.ini before it will work [extensions] hgext.convert= – keyoke Mar 23 '11 at 12:23
  • Looks like a good approach but would it still work if I want to remove specific files? Say a specific dll? Could you use?: exclude MyDll.dll – Tal Even-Tov Feb 14 '14 at 09:39
  • 1
    Yes. It's a "good approach" only if you're okay w/ having a different repository when you're done that's unrelated to the original in any way Mercurial can tell. So everyone you work with will have to delete and re-clone. That's fine for small teams or early on, but pretty much a "last resort" sort of thing in a larger setting. – Ry4an Brase Feb 14 '14 at 21:47