summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/combo-layer40
-rw-r--r--scripts/combo-layer.conf.example13
2 files changed, 53 insertions, 0 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 6d24ce3ee1..cbff61803b 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -284,6 +284,46 @@ def action_init(conf, args):
284 runcmd("git branch -D %s" % refname, ldir) 284 runcmd("git branch -D %s" % refname, ldir)
285 # Make that the head revision. 285 # Make that the head revision.
286 runcmd("git checkout -b %s %s" % (name, initialrev)) 286 runcmd("git checkout -b %s %s" % (name, initialrev))
287 # Optional: cut the history by replacing the given
288 # start point(s) with commits providing the same
289 # content (aka tree), but with commit information that
290 # makes it clear that this is an artifically created
291 # commit and nothing the original authors had anything
292 # to do with.
293 since_rev = repo.get('since_revision', '')
294 if since_rev:
295 committer = runcmd('git var GIT_AUTHOR_IDENT').strip()
296 # Same time stamp, no name.
297 author = re.sub('.* (\d+ [+-]\d+)', r'unknown <unknown> \1', committer)
298 logger.info('author %s' % author)
299 for rev in since_rev.split():
300 # Resolve in component repo...
301 rev = runcmd('git log --oneline --no-abbrev-commit -n1 %s' % rev, ldir).split()[0]
302 # ... and then get the tree in current
303 # one. The commit should be in both repos with
304 # the same tree, but better check here.
305 tree = runcmd('git show -s --pretty=format:%%T %s' % rev).strip()
306 with tempfile.NamedTemporaryFile() as editor:
307 editor.write('''cat >$1 <<EOF
308tree %s
309author %s
310committer %s
311
312%s: squashed import of component
313
314This commit copies the entire set of files as found in
315%s %s
316
317For more information about previous commits, see the
318upstream repository.
319
320Commit created by combo-layer.
321EOF
322''' % (tree, author, committer, name, name, since_rev))
323 editor.flush()
324 os.environ['GIT_EDITOR'] = 'sh %s' % editor.name
325 runcmd('git replace --edit %s' % rev)
326
287 # Optional: rewrite history to change commit messages or to move files. 327 # Optional: rewrite history to change commit messages or to move files.
288 if 'hook' in repo or dest_dir and dest_dir != ".": 328 if 'hook' in repo or dest_dir and dest_dir != ".":
289 filter_branch = ['git', 'filter-branch', '--force'] 329 filter_branch = ['git', 'filter-branch', '--force']
diff --git a/scripts/combo-layer.conf.example b/scripts/combo-layer.conf.example
index 38bc53c59f..90e2b58723 100644
--- a/scripts/combo-layer.conf.example
+++ b/scripts/combo-layer.conf.example
@@ -63,11 +63,24 @@ last_revision =
63# example: 63# example:
64# hook = combo-layer-hook-default.sh 64# hook = combo-layer-hook-default.sh
65 65
66# since_revision:
67# since_revision = release-1-2
68# since_revision = 12345 abcdf
69#
70# If provided, truncate imported history during "combo-layer --history
71# init" at the specified revision(s). More than one can be specified
72# to cut off multiple component branches.
73#
74# The specified commits themselves do not get imported. Instead, an
75# artificial commit with "unknown" author is created with a content
76# that matches the original commit.
77
66[oe-core] 78[oe-core]
67src_uri = git://git.openembedded.org/openembedded-core 79src_uri = git://git.openembedded.org/openembedded-core
68local_repo_dir = /home/kyu3/src/test/oecore 80local_repo_dir = /home/kyu3/src/test/oecore
69dest_dir = . 81dest_dir = .
70last_revision = 82last_revision =
83since_revision = some-tag-or-commit-on-master-branch
71 84
72# It is also possible to embed python code in the config values. Similar 85# It is also possible to embed python code in the config values. Similar
73# to bitbake it considers every value starting with @ to be a python 86# to bitbake it considers every value starting with @ to be a python