git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Merging (joining/stiching/rewriting) history of "unrelated" git repositories

From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date
May 17, 2019, 13:08 UTC
Message-ID
<CAA01Csq0eX2L5cKpjjySs+4e0Sm+vp=10C_SAkE6CLpCHBWZ8g@mail.gmail.com>
In-Reply-To
<CAA01Csqu6g0QPLNG5LOnkSzN=-De5X=KnqyDS3Bqb980+_FQ+A@mail.gmail.com>

On Thu, May 16, 2019 at 8:38 AM Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:

Show 15 quoted lines
>
> On Wed, May 15, 2019 at 10:34 PM Elijah Newren <newren@gmail.com> wrote:
> >
> > On Wed, May 15, 2019 at 8:30 AM Ævar Arnfjörð Bjarmason
> > <avarab@gmail.com> wrote:
> > >
> > > On Wed, May 15 2019, Piotr Krukowiecki wrote:
> > >
> > > > Hello,
> > > >
> > > > I'm migrating two repositories from svn. I already did svn->git
> > > > migration (git-svn clone) and now have two git repositories.
> > > >
> > > > I would like to merge them into 1 git repository, but to merge also
> > > > history - branches and tags.
[...]
Show 14 quoted lines
> > > You might be able to use https://github.com/newren/git-filter-repo
> >
> > Splicing repos is an interesting case, but unless the history is
> > linear and the branch/tag names exactly match and you are simplify
> > weaving commits together based on timestamp within the same
> > branch/tag, then I don't know what algorithm should be used to weave
> > them together.  There are lots of choices, and "correct" may be very
> > usecase-specific.
> >
> > That said, filter-repo was designed to be usable as a library and has
> > a few simple examples of such usage, including one of splicing some
> > trivial repos together.  (See
> > https://github.com/newren/git-filter-repo/blob/master/t/t9391/splice_repos.py
> > and https://github.com/newren/git-filter-repo/blob/master/t/t9391-filter-repo-lib-usage.sh#L90-L121)

I'll try writing some script using the filter-repo. Looked at splice_repos.py and fast-export/fast-import format and it looks promising / relatively simple.

Show 6 quoted lines
> > Somewhat interestingly, a search on others having tried to solve this
> > same problem turned up
> > https://github.com/j5int/jbosstools-gitmigration, which apparently is
> > based on git_fast_filter, which is the predecessor of filter-repo.
> > Perhaps that tool would be useful to you as-is, though they apparently
> > do ignore merges.
I tried using it but it didn't work. Don't remember what was the problem though.
> Maybe I should look for a way to first prepare "merged" svn repo
> projectAB. Maybe there's a tool which can do it. And then migrate it
> to svn.

I tried this - use svnadmin dump + svndumpfilter + svnadmin load to remodel svn repository and "splice" the history (by replacing 2nd project paths to appear to be added to the 1st project path). But it didn't work. The resulting svn repository had incorrect history (from my point of view).

I also looked at reposurgeon. Maybe it could do the splicing, but I given up on learning it, documentation isn't very helpful and there's not enough examples in the internet...

-- 
Piotr Krukowiecki
Previous: Piotr KrukowieckiNext: Jakub Narebski
Message 5 of 8 in “Merging (joining/stiching/rewriting) history of "unrelated" git repositories”
  1. Piotr KrukowieckiMay 15, 2019
  2. Ævar Arnfjörð BjarmasonMay 15, 2019
  3. Elijah NewrenMay 15, 2019
  4. Piotr KrukowieckiMay 16, 2019
  5. Piotr KrukowieckiMay 17, 2019
  6. Jakub NarebskiMay 20, 2019
  7. Piotr KrukowieckiMay 21, 2019
  8. Piotr KrukowieckiMay 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.