## Updating double-conversion from Github to Vendor
-Go to https://github.com/google/double-conversion/releases/latest/ to determine the latest version number; for the examples below, suppose it is `v3.0.0`.
+IMPORTANT: Please start with a clean working directory before continuing (no uncommitted changes).
+
+Go to https://github.com/google/double-conversion/releases/latest/ to determine the latest version number. You can also pull from a branch instead of a tag.
Run `pull-from-upstream.sh` as below:
- ./pull-from-upstream.sh v3.0.0
+ ./pull-from-upstream.sh <tag/branch>
+
+You will be prompted to download the tarball. If confirmed, the script will overwrite the contents of the upstream directory.
## Updating double-conversion from Vendor to ICU4C
-The relevant files from double-conversion are copied (svn cp) from Vendor to icu4c/source/i18n. In order to integrate changes from a new version of double-conversion, the changes in Vendor after updating from Github should be merged into their corresponding copies in ICU4C.
+After completing the first step, the script will stop again and ask you whether to copy the diffs into icu4c. If you say yes, the *diff between the git index and the working copy* (i.e., the output of `git diff`) will be applied to the corresponding files in icu4c.
-Instructions on how to do this should be written by the first person who performs such an update.
+Make note of the output of the command. If there are any merge conflicts, you will need to resolve them manually.
-For reference, the original commit including all of the svn copies is here:
+## Next Steps
-http://bugs.icu-project.org/trac/changeset/40929
+Build and test icu4c, and send the PR for review.
if [[ -z $1 ]]; then
echo "Pass the current version tag of double-conversion as the first argument to this script";
+ echo "To pull the latest changes, use 'master'"
exit 1;
fi
filename="$1.tar.gz"
url="https://github.com/google/double-conversion/archive/$1.tar.gz";
+upstream_root="$(dirname "$0")/upstream";
+icu4c_i18n_root="$(dirname "$0")/../../icu4c/source/i18n";
-echo "Updating upstream to $1";
echo "Will download $url";
-read -p "Press any key to continue";
-
-rm -f $filename;
-wget $url;
-rm -r upstream; # in case any files were deleted in the new version
-mkdir upstream;
-tar zxf $filename --strip 1 -C upstream;
-rm $filename;
-echo "upstream updated and $filename removed";
+echo "Will expand into $upstream_root";
+read -p "Press Enter to continue or s to skip: " ch;
+
+if [ "$ch" != "s" ]; then
+ rm -f $filename;
+ wget $url;
+ rm -r "$upstream_root"; # in case any files were deleted in the new version
+ mkdir "$upstream_root";
+ tar zxf $filename --strip 1 -C "$upstream_root";
+ rm $filename;
+ echo "upstream updated and $filename removed";
+fi
+
+echo "Will apply diffs to $icu4c_i18n_root";
+read -p "Press Enter to continue or s to skip: " ch;
+
+do_patch() {
+ vendor_path="$upstream_root/double-conversion/$1";
+ icu4c_path="$icu4c_i18n_root/$2";
+ git diff --patch "$vendor_path" | patch --merge "$icu4c_path";
+}
+
+do_patch_prefix_extension() {
+ do_patch "$1.$2" "double-conversion-$1.$3";
+}
+
+do_patch_extension() {
+ do_patch "$1.$2" "$1.$3";
+}
+
+if [ "$ch" != "s" ]; then
+ do_patch_prefix_extension bignum-dtoa cc cpp;
+ do_patch_prefix_extension bignum-dtoa h h;
+ do_patch_prefix_extension bignum cc cpp;
+ do_patch_prefix_extension bignum h h;
+ do_patch_prefix_extension cached-powers cc cpp;
+ do_patch_prefix_extension cached-powers h h;
+ do_patch_prefix_extension diy-fp cc cpp;
+ do_patch_prefix_extension diy-fp h h;
+ do_patch_prefix_extension fast-dtoa cc cpp;
+ do_patch_prefix_extension fast-dtoa h h;
+ do_patch_prefix_extension ieee h h;
+ do_patch_prefix_extension utils h h;
+ do_patch_extension double-conversion cc cpp;
+ do_patch_extension double-conversion h h;
+fi