Chris
Chris

Reputation: 357

How to skip subrepo in tortoise hg

I am using tortoise hg and my repository contains subrepo. The subrepo is very large and takes really really long time to update.

Is there a way to update my repository but skip updating the subrepo?

Upvotes: 0

Views: 990

Answers (2)

Chris
Chris

Reputation: 357

Here is a trick that I use:

  • Have a local repository of the subrepo in ANOTHER folder. I copied the folder from a colleague of mine.

  • Setup new repo. Pull the changes (don't update yet). CLONE the local subrepo into the appropriate location in the new repo. Now update and tortoiseHg will only fetch the diff in that subrepo.

  • At this point, your subrepo points to the local copy. Once everything is update-to-date. Point the subrepo to the one in remote server.

Of course, this only works if you or somebody already has a copy of the subrepo.

Upvotes: 0

Tim Henigan
Tim Henigan

Reputation: 62218

The update command is intended to always operate on the entire repository. There is no option to exclude a subrepo.

However if you structure your repository correctly, you should be able to achieve what you need.

I expect that you run into this problem because your project repo looks like this:

parent/
    .hgsub
    .hgsubstate
    subrepo/
    your_project_file.py

With the above structure, update is forced to operate on both the files under your control (in parent) and also your subrepo. A better (and more flexible) way to structure your repository is this:

build_repo/       # top-level repo that is empty except for .hgsub
    .hgsub
    .hgsubstate
    your_repo/    # your code as a subrepo
    subrepo/      # the library code as a subrepo

With this structure, you could update your_repo without requiring an update to the libraries you depend on.

Upvotes: 3

Related Questions