Add a small mercurial repository as a sub-directory of a larger one - how?
Marcin Kasperski
Marcin.Kasperski at mekk.waw.pl
Mon Aug 27 10:20:05 UTC 2018
Chris Green <cl at isbd.net> writes:
> I have a small mercurial repository (a bin directory on a host called
> odin) that I want to add in to my main 'keep all my configuration
> files and scripts' repository.
>
> The files from odin's bin directory will live at <root>/odin/bin in
> the main repository, this will be a new sub-directory.
>
> How do I add in this sub-directory and keep the history?
1. Use hg convert (hg→hg) to create repository which copies your
original, but modifies paths prepending bin/ to them. Something like
(untested)
$ cat >myconvert.config <<END
include "."
rename "." "bin"
END
hg convert --filemap=myconvert.config your/bin/repo
patched_bin_repo
Expected result: patched_bin_repo contains the same history (of course
with different hashes) but everything is under bin/ subdirectory
there.
2. Force-pull those changes to your destination
cd «…»/odin
hg pull --force path/to/patched_bin_repo
(this creates unrelated head)
3. Merge and commit.
cd «…»/odin
hg merge
hg commit -m "Migrated bin"
More information about the Mercurial
mailing list