telemetry for hot-decl-saving
[hiphop-php.git] / third-party / apply-quilt-patches.sh
blob8c118988a94c2deab300555b7c9a23f6ce476e24
1 #!/bin/sh
3 # Copyright (c) 2015-present, Facebook, Inc.
4 # All rights reserved.
6 # This source code is licensed under the MIT license found in the
7 # LICENSE file in the root directory of this source tree.
10 # Applies a patch series maintained with the `quilt` tool
12 # The format is straightforward: if you have `foo.patch` and `bar.patch`,
13 # applied in that order, `patches/` contains:
15 # - bar.patch
16 # - foo.patch
17 # - series
19 # The 'series' file contains:
21 # ```
22 # foo.patch
23 # bar.patch
24 # ```
26 # Quilt uses the presence of a patches/ subdir to identify the root, similar
27 # to how Hack uses `.hhconfig` - so, to use quilt with an out-of-source patch
28 # dir is a little bit of work:
30 # ```
31 # $ cd ~/code/hhvm/build/third-party/fb-mysql/bundled_fbmysqlclient-prefix/src/bundled_fbmysqlclient/
32 # $ ln -s ~/code/hhvm/third-party/fb-mysql/patches
33 # $ export QUILT_PATCHES=$(pwd)/patches
34 # ```
36 # The essential commands are `quilt add`, `quilt refresh`, `quilt push`, and
37 # `quilt pop`.
39 QUILT_PATCHES="$1"
40 if [ ! -d "$QUILT_PATCHES" ]; then
41 echo "Usage: $0 /path/to/patches"
42 exit 1
45 set -e
47 cat "$QUILT_PATCHES/series" | while read PATCH_FILE; do
48 echo "Applying patch $PATCH_FILE..."
49 patch -p1 < "$QUILT_PATCHES/$PATCH_FILE"
50 echo "... applied patch $PATCH_FILE."
51 done
52 echo "Applied all patches!"