diff --git a/README b/README.md similarity index 85% rename from README rename to README.md index 57cf1be..034da43 100644 --- a/README +++ b/README.md @@ -8,7 +8,7 @@ TripleO (or other gerrit based projects). - some example inputs for doing rack testing of tripleo in the rack-testing subdir -To use: +## Usage * create a repo_refs.yaml in your TRIPLEO_ROOT (see the one in the root of this repository for inspiration). @@ -18,7 +18,10 @@ To use: * run prep_source_repos $YOUR\_REFS\_FILE $TRIPLEO\_ROOT to checkout and update the repositories specified by the refs file. Note that local edits are saved - via git stash whenever you refresh your source repos. + via git stash whenever you refresh your source repos, and restored after the + update (which may, of course, fail). This provides a convenient way to use + local edits / work in progress for repositories that are used directly (vs + e.g. those that are cloned into images). * source YOUR_REFS_FILE.variables to configure TripleO scripts to use your freshly integrated branches diff --git a/bin/prep_source_repos b/bin/prep_source_repos index a9bcf8b..53ee08e 100755 --- a/bin/prep_source_repos +++ b/bin/prep_source_repos @@ -81,7 +81,9 @@ def main(): else: components.append(ref) branch_name = 'rollup_' + '_'.join(components) - check_call(['git', 'stash'], cwd=rd) + dirty = check_output(['git', 'status', '-z', '-uno'], cwd=rd) + if dirty: + check_call(['git', 'stash'], cwd=rd) branches = check_output(['git', 'branch', '-a'], cwd=rd) if ' ' + branch_name in branches: print 'Resetting existing branch %s...' % branch_name @@ -93,6 +95,8 @@ def main(): if len(ref.split('/')) == 3: ref = 'refs/changes/%s' % ref check_call(['git', 'merge', '--no-edit', ref], cwd=rd) + if dirty: + check_call(['git', 'stash', 'pop'], cwd=rd) normalised_repo = re.sub('[^A-Za-z0-9_]', '_', repo) if repo not in CONF['gerrit_refs']: print 'no refs for %s' % repo