Add a small mercurial repository as a sub-directory of a larger one - how?

Arne Babenhauserheide arne_bab at web.de
Sat Aug 25 16:17:12 UTC 2018


Chris Green <cl at isbd.net> writes:

> On Sat, Aug 25, 2018 at 12:08:08PM +0200, Arne Babenhauserheide wrote:
>> Hi Chris,
>> 
>> 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?
>> 
>> You can simply copy it there and add it to .hgsub; see
>> https://www.mercurial-scm.org/wiki/Subrepository
>> 
> That doesn't really do what I want, or at least I don't think it does.
>
> It looks as if I'd forever need to know that it was a sub-repository
> within my main repository for Mercurial to work properly with the
> files there.  It's also a "feature of last resort" and I really don't
> see any reason to use it in my situation.

Ah, so you don’t actually want a subrepo, you just want to keep the
history?

Then:

cd path/to/bin/
hg mv * bin/
hg ci -m "move to subrepo"
cd path/to/odin
hg pull --force path/to/bin
hg merge
hg ci -m "merge bin subfolder into odin"

This becomes somewhat cleaner with the convert extension:
- replace the hg mv by a convert with a rename filemap
- otherwise follow the steps above

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1076 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20180825/f463baa1/attachment.asc>


More information about the Mercurial mailing list