summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/buildbranch.py12
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py1
-rw-r--r--yarns/branches-workspaces.yarn37
3 files changed, 46 insertions, 4 deletions
diff --git a/morphlib/buildbranch.py b/morphlib/buildbranch.py
index 885f5cf8..067ae55e 100644
--- a/morphlib/buildbranch.py
+++ b/morphlib/buildbranch.py
@@ -125,14 +125,18 @@ class BuildBranch(object):
sb_info = {}
for gd, (build_ref, index) in self._to_push.iteritems():
- repo, ref = gd.get_config('morph.repository'), gd.HEAD
- sb_info[repo, ref] = (gd, build_ref)
+ if gd == self._root:
+ continue
+ morph_name = gd.get_config('morph.chunk-name')
+ sb_info[morph_name] = (gd, build_ref)
def filter(m, kind, spec):
- return (spec.get('repo'), spec.get('ref')) in sb_info
+ name = (spec['name'] if 'name' in spec else spec['morph'])
+ return name in sb_info
def process(m, kind, spec):
+ name = (spec['name'] if 'name' in spec else spec['morph'])
+ gd, build_ref = sb_info[name]
repo, ref = spec['repo'], spec['ref']
- gd, build_ref = sb_info[repo, ref]
if (repo, ref) == (root_repo, root_ref):
spec['repo'] = None
spec['ref'] = None
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index a258cd70..133c1d1f 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -309,6 +309,7 @@ class BranchAndMergePlugin(cliapp.Plugin):
cached_repo = lrc.get_updated_repo(chunk_url)
gd = sb.clone_cached_repo(cached_repo, chunk_ref)
+ gd.set_config('morph.chunk-name', chunk_name)
system_branch_ref = gd.disambiguate_ref(sb.system_branch_name)
sha1 = gd.resolve_ref_to_commit(chunk_ref)
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index de9f95a3..e77d2611 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -224,6 +224,15 @@ build branch is made to include that change.
AND the user builds systems/test-system.morph of the master branch
THEN the changes to test-chunk in branch master are included in the temporary build branch
+It's also useful to be able to check out other branches to see the effect
+of building those changes instead.
+
+ GIVEN a different branch of test-chunk to build from
+ WHEN the user checks out the different branch of test-chunk in branch master
+ AND the user builds systems/test-system.morph of the master branch
+ THEN the state of the current branch of test-chunk in branch master is included in the temporary build branch
+ AND test-chunk of branch master's tree was used in the most recently built system
+
### When branches are created ###
It's convenient to have Temporary Build Branches, but we don't always
@@ -397,6 +406,34 @@ Nor do we need temporary build branches for distributed builds.
--format='git cat-file -p %(refname):test-bin | diff test-bin -' \
"$build_ref_prefix")"
+ IMPLEMENTS GIVEN a (\S+) branch of (test-chunk) to build from
+ cd "$DATADIR/gits/$MATCH_2"
+ git checkout -b "$MATCH_1"
+ sed -i 's/Hello/Farewell/g' test-bin
+ git add test-bin
+ git commit -m 'Change message of test-bin'
+
+ IMPLEMENTS WHEN the user checks out the (\S+) branch of (\S+) in branch (\S+)
+ chunkdir="$(slashify_colons "test:$MATCH_2")"
+ cd "$DATADIR/workspace/$MATCH_3/$chunkdir"
+ git remote update
+ git clean -fxd
+ git reset --hard HEAD
+ git checkout "$MATCH_1"
+
+ IMPLEMENTS THEN the state of the current branch of (\S+) in branch (\S+) is included in the temporary build branch
+ chunkdir="$(slashify_colons "test:$MATCH_1")"
+ cd "$DATADIR/workspace/$MATCH_2/$chunkdir"
+ eval "$(git for-each-ref --count=1 --shell --sort=committerdate \
+ --format='test "$(git rev-parse HEAD^{tree})" = %(tree)' \
+ "$build_ref_prefix")"
+
+ IMPLEMENTS THEN (test-chunk) of branch (\S+)'s tree was used in the most recently built system
+ chunkdir="$(slashify_colons "test:$MATCH_1")"
+ cd "$DATADIR/workspace/$MATCH_2/$chunkdir"
+ artifact="$(ls -t "$DATADIR/cache/artifacts/"*.system.*-rootfs | head -n1)"
+ tar -xf "$artifact" -O usr/libexec/test-bin | diff test-bin -
+
IMPLEMENTS WHEN the user commits changes to (\S+) in branch (\S+)
chunkdir="$(slashify_colons "test:$MATCH_1")"
cd "$DATADIR/workspace/$MATCH_2/$chunkdir"