capture itemized output from rsync
This CL causes the stdout of rsync quickmerge to get captured rather
than sent to the terminal.
BUG=chromium:229234
TEST=Modified unit test so that it passes.
Change-Id: Ib65c2812b736e7556a28aa8712a03c7825ed8df2
Reviewed-on: https://gerrit.chromium.org/gerrit/47960
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
diff --git a/scripts/autotest_quickmerge.py b/scripts/autotest_quickmerge.py
index be93e19..3cb5761 100755
--- a/scripts/autotest_quickmerge.py
+++ b/scripts/autotest_quickmerge.py
@@ -81,7 +81,7 @@
def RsyncQuickmerge(source_path, sysroot_autotest_path,
include_pattern_file=None, pretend=False,
- overwrite=False, quiet=False):
+ overwrite=False):
"""Run rsync quickmerge command, with specified arguments.
Command will take form `rsync -a [options] --exclude=**.pyc
--exclude=**.pyo
@@ -92,7 +92,6 @@
pretend: True to use the '-n' option to rsync, to perform dry run.
overwrite: True to omit '-u' option, overwrite all files in sysroot,
not just older files.
- quiet: True to omit the '-i' option, silence rsync change log.
"""
command = ['rsync', '-a']
@@ -102,8 +101,7 @@
if not overwrite:
command += ['-u']
- if not quiet:
- command += ['-i']
+ command += ['-i']
command += ['--exclude=**.pyc']
command += ['--exclude=**.pyo']
@@ -119,7 +117,7 @@
command += [source_path, sysroot_autotest_path]
- cros_build_lib.SudoRunCommand(command)
+ return cros_build_lib.SudoRunCommand(command, redirect_stdout=True)
def ParseArguments(argv):
@@ -162,10 +160,15 @@
sysroot_autotest_path = os.path.join('/build', args.board, 'usr', 'local',
'autotest', '')
- RsyncQuickmerge(source_path, sysroot_autotest_path, include_pattern_file,
- args.pretend, args.overwrite, args.quiet)
+ rsync_output = RsyncQuickmerge(source_path, sysroot_autotest_path,
+ include_pattern_file, args.pretend, args.overwrite)
- print 'Done'
+ print rsync_output.output
+
+ change_report = ItemizeChangesFromRsyncOutput(rsync_output.output,
+ sysroot_autotest_path)
+
+ print change_report
if __name__ == '__main__':