diff options
author | Samuel Huang <huangs@chromium.org> | 2018-03-21 18:54:03 +0000 |
---|---|---|
committer | Edward Lesmes <ehmaldonado@google.com> | 2021-07-23 21:58:36 +0000 |
commit | 1bb3b651b14c9cec5cf0104a1dec1550b9c22983 (patch) | |
tree | 6c50b80ae3ef0e87d09a70a233e9c37f3e0ff4e1 /zucchini_commands.cc | |
parent | 6d057299c73d1c69ddd3084eb7cd1d25d8c70002 (diff) | |
download | zucchini-1bb3b651b14c9cec5cf0104a1dec1550b9c22983.tar.gz |
[Zucchini] Add "-keep" flag; remove redundnat CRC32 check.
By defaulti, Zucchini deletes the output (patch or patched "new") file
upon failure. The "-keep" debug flag overrides this behavior, so the
bad output file can be examined. This CL adds the flag for Zucchini-gen
and Zucchini-apply.
This CL also removes a duplicated call to Ensemble::CheckOldFile(),
which checks the CRC32 of the "old" file. This removal prevents
redundant work and slightly speed up Zucchini-apply (by ~5%).
Bug: 729154
Change-Id: I9ba8e9b00b7783661de06b39fae010761bedc6e6
Reviewed-on: https://chromium-review.googlesource.com/973746
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544786}
NOKEYCHECK=True
GitOrigin-RevId: 21879c3adbfbbf676e5ee28b9f0a19e60d104d80
Diffstat (limited to 'zucchini_commands.cc')
-rw-r--r-- | zucchini_commands.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/zucchini_commands.cc b/zucchini_commands.cc index 53b5bd7..2d4b156 100644 --- a/zucchini_commands.cc +++ b/zucchini_commands.cc @@ -29,6 +29,7 @@ namespace { /******** Command-line Switches ********/ constexpr char kSwitchDump[] = "dump"; +constexpr char kSwitchKeep[] = "keep"; constexpr char kSwitchRaw[] = "raw"; } // namespace @@ -79,6 +80,9 @@ zucchini::status::Code MainGen(MainParams params) { return zucchini::status::kStatusFileWriteError; } + if (params.command_line.HasSwitch(kSwitchKeep)) + patch.Keep(); + if (!patch_writer.SerializeInto(patch.region())) return zucchini::status::kStatusPatchWriteError; @@ -91,7 +95,8 @@ zucchini::status::Code MainGen(MainParams params) { zucchini::status::Code MainApply(MainParams params) { CHECK_EQ(3U, params.file_paths.size()); return zucchini::Apply(params.file_paths[0], params.file_paths[1], - params.file_paths[2]); + params.file_paths[2], + params.command_line.HasSwitch(kSwitchKeep)); } zucchini::status::Code MainRead(MainParams params) { |