-1

I have an hg (Mercurial) repo located at, say:

http://myhg:5000/projects/fizzbuzz

This fizzbuz directory has the following basic structure:

fizzbuzz/
    src/
        ... thousands of source files
    docs/
        ... lots of docs
    tests/
        ... lots of tests

I am now completely re-engineering the fizzbuzz app. The new app's project structure will be completely different (from the top down) than the existing one:

fizzbuzz/
    herps/
        foo/
            ... thousands of foos
        bar/
            ... thousands of bars
    derps/
        ... lots of derps

It's essentially a brand new app. I guess one solution would be to delete the fizzbuzz repo and then create a new one and add my code to the new one. But I was wondering if there's a way to basically tell hg to erase everything in a repo (but not delete the repo), and then add in the new, re-engineered, content. Or some other way to elegantly swap out the new code base for the old. Ideas? Thanks in advance!

unfettered
  • 351
  • 3
  • 13

2 Answers2

0

Sure, you can wipe a repository by deleting everything and commiting all the changes (all the deletions). If you ever need to restore or review the old code it will still be available by checking out the revisions prior to the deletion. Unless your repository is very large on disk this is probably the way to go--alternatively you can start a new repository for the new version and leave the current one as-is.

In either case deleting all the code and its history is typically unwise.

STW
  • 44,917
  • 17
  • 105
  • 161
0

Take a look at the Convert extension. While it is, by design, not possible to change the history of your current repository, you can, via hg convert, construct a new repository based on the history of an existing repository. This is very useful for scenarios like you describe, where you need to refactor the file-structure to such a degree that the old history is no longer useful.

That said, consider just making the changes directly in your current repository. What actual benefit do you get by rewriting history? Make the changes now, and Mercurial will continue doing it's job of tracking where you came from.

dimo414
  • 47,227
  • 18
  • 148
  • 244