Darcs equivalent for git submodules?

so yes, just wondering if darcs has anything equivalent to git submodules.

i.e. let's say I have repo (myapp) and I have a folder in it called mylibrary. mylibrary has nothing to do with myapp development, it just needs to be included. The development of mylibrary takes place in its own repo, but when someone pulls myapp, it will also pull out the latest version of mylibrary. any ideas?

+7
source share
2 answers

My first thought: since darcs are simpler than git (i.e. there are no branches and consoles), instead you just use directories and URLs, and it is your task to manage them), the dark submodule will not give you more what you can achieve with standard things like subdirectories or files inside you darcs repo.

  • If you need a submodule to fix the specific state of the source of the library you are using, you could just put a copy of the repo in the library as a subdir and add it to the darcs project. Compared to git, this will have the disadvantage of inflating data transfer when someone gets your repo.

  • If you need a submodule to tell those who receive your repo where to get the updated library source (without inflating the size of your repo), you can simply put the URL and instruction in a README file, or script, or something else. Compared to git, the disadvantage is that the state of the library source, as it was when you used it, will not be recorded in your commit, so people can get a different version of the library and the compilation will not work, and it would not be clear why.

So, the really interesting goal of the submodule can be not only to tell people where to get the source of the library from (as you write in the question), but also to record the state of the subproject that you actually used to compile your project, rather than inflate your repo for those who don’t wants to get the source of the subproject.

Perhaps this goal can also be achieved by storing more complex metadata about the state of the subproject and a more complex hook to get exactly that state (or, optionally, another state) of the subproject. AFAIK from documents, for such submodules there is no built-in mechanism.

Update (found on darcs website):

So the darks will notice another darcs reporter in your work, and he will not touch it. Therefore, the first method that I suggested above is closed (if you leave darcs metadata there).

The second method is similar to that proposed in one of the sections of the last link. (They offer an "uglu" script for something like this.)

Another (3rd) idea

Import the fixes from the repo that you intend to use as a submodule, but first move all the files to the subdirectory. If you could just apply such a movable special patch once, and if it was effective for all patches, you import from the repo intended as a submodule, but not for the patches that you import from the "branch", the main repo ...

... well, it could be a special version of the pull command (say import ) and the push command (say export ), which will additionally translate the paths accordingly.

+4
source

I don't know a single submodule concept for darcs, which means that the usual way to refer to another (generic) repo from darcs repo will be through symbolic links.

Since symbolic links are not supported with darcs , this means that you need to install a " posthook sh update-symlinks.sh " hook script to restore these links.

But you can also add a check to this hook to first see which version of the processed repo is currently downloaded, and if necessary update this version (provided that you somehow saved the exact version that you need for this general repo) .
The last sentence is really close to implementing Git submodules or the Mercurial subsurface.

+3
source

All Articles