Vanush Vee
Vanush Vee

Reputation: 454

Change root directory of repo in Mercurial

I'm working on an Android game with the folder structure:

\bin
\data (contains game graphics)
\libs (libgdx engine jars)
\src
----\com
--------\brand
------------\game
                 (*.class files)

Foolishly, I created a mercurial repository (hg init) in the \src directory. Thus, if I update any of the graphics (small file sizes), they aren't added to the repo when I commit. My question is: how can I change the root of the repo to include the \data directory as well as the \src directory, but without including the \libs directory as that includes 10-20mb jars?

Upvotes: 2

Views: 2435

Answers (2)

Ludovic Chabant
Ludovic Chabant

Reputation: 1513

If you don't want to just do an hg rename, you can do it with the convert extension (which comes by default with Mercurial, you just need to enable it in your .hgrc).

Run it with the --filemap parameter and a filemap file that has something like:

rename com src/com

You will end up with a new repository with all of your history, but with your com directory moved into src/com. You can then copy you bin, data and libs folders in there, run hg addremove and you should be all good to go.

Warning: the new repo is completely different than the old one -- changeset IDs and such will be different, so anybody you worked with in the past will have to get on the new repo.

Upvotes: 2

Mark Robinson
Mark Robinson

Reputation: 3165

There are two ways to do this.

1) Start a new repo. It's quick and easy but you'll lose your history.

2) Use hg rename. This is effectively a move command.

Rename the src directory to be something meaningful and then do this.

  1. hg rename MyProject/com MyProject/src/com
  2. Copy all the files/folders into the MyProject/ directory.
  3. Mark bin and libs as ignorable and
  4. Add everything else.
  5. hg commit

Upvotes: 4

Related Questions