]> code.ossystems Code Review - openembedded-core.git/commitdiff
combo-layer: combine trees via replacement objects
authorPatrick Ohly <patrick.ohly@intel.com>
Thu, 12 Mar 2015 15:45:34 +0000 (16:45 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 20 Mar 2015 11:03:09 +0000 (11:03 +0000)
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".

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/combo-layer

index d11274e245e2157c5c7cbbcb57c874aaa49bfe46..6d24ce3ee15d8ad19bffe4f46075d087fbbc7857 100755 (executable)
@@ -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: