简体   繁体   中英

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM