combo-layer: combine trees via replacement objects

Instead of local graft entries rooting the imported branches in the
shared root commit, use replacement objects.

The advantage is that they get moved around by "git push" and "git
fetch", so everyone has the same, nicer view with everything starting
at the beginning of the combined repository.

If undesired, these objects can be removed with "git replace".

(From OE-Core rev: 220d816cda3c9b8d888288cc03eb74be5e71cc59)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Patrick Ohly 2015-03-12 16:45:34 +01:00 committed by Richard Purdie
parent dd985a241c
commit 14eac2a474
1 changed files with 8 additions and 8 deletions

View File

@ -354,14 +354,14 @@ file_exclude = %s''' % (name, file_filter or '<empty>', repo.get('file_exclude',
# Create Octopus merge commit according to http://stackoverflow.com/questions/10874149/git-octopus-merge-with-unrelated-repositoies
runcmd('git checkout master')
merge = ['git', 'merge', '--no-commit']
with open('.git/info/grafts', 'w') as grafts:
grafts.write('%s\n' % startrev)
for name in conf.repos:
repo = conf.repos[name]
# Use branch created earlier.
merge.append(name)
for start in runcmd('git log --pretty=format:%%H --max-parents=0 %s' % name).split('\n'):
grafts.write('%s %s\n' % (start, startrev))
for name in conf.repos:
repo = conf.repos[name]
# Use branch created earlier.
merge.append(name)
# Root all commits which have no parent in the common
# ancestor in the new repository.
for start in runcmd('git log --pretty=format:%%H --max-parents=0 %s' % name).split('\n'):
runcmd('git replace --graft %s %s' % (start, startrev))
try:
runcmd(merge)
except Exception, error: