From 32f5d4c10444e4827d138af27833ea9ccc522830 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 17 May 2020 00:06:31 +0100 Subject: [PATCH] third_party/copybara: patch HgRepository to use HGPLAIN --- third_party/copybara/copy.bara.sky | 5 ++- .../com/google/copybara/hg/HgRepository.java | 6 +++- .../patches/0002-HgRepository-HGPLAIN.patch | 32 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 third_party/copybara/patches/0002-HgRepository-HGPLAIN.patch diff --git a/third_party/copybara/copy.bara.sky b/third_party/copybara/copy.bara.sky index 78aaeb18cd..ea9234c72c 100644 --- a/third_party/copybara/copy.bara.sky +++ b/third_party/copybara/copy.bara.sky @@ -18,7 +18,10 @@ core.workflow( ), authoring = authoring.pass_thru("Default email "), transformations = [ - patch.apply(patches = ["patches/0001-Make-Mercurial-at-least-slightly-usable.patch"]), + patch.apply(patches = [ + "patches/0001-Make-Mercurial-at-least-slightly-usable.patch", + "patches/0002-HgRepository-HGPLAIN.patch", + ]), core.move("", "third_party/copybara"), ], ) diff --git a/third_party/copybara/java/com/google/copybara/hg/HgRepository.java b/third_party/copybara/java/com/google/copybara/hg/HgRepository.java index 40bc2663c4..40c96bd012 100644 --- a/third_party/copybara/java/com/google/copybara/hg/HgRepository.java +++ b/third_party/copybara/java/com/google/copybara/hg/HgRepository.java @@ -51,6 +51,8 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.HashMap; +import java.util.Map; import javax.annotation.Nullable; /** @@ -240,8 +242,10 @@ public class HgRepository { List allParams = new ArrayList<>(Iterables.size(params) + 1); allParams.add("hg"); //TODO(jlliu): resolve Hg binary here Iterables.addAll(allParams, params); + Map environment = new HashMap<>(); + environment.put("HGPLAIN", ""); Command cmd = new Command( - Iterables.toArray(allParams, String.class), null, cwd.toFile()); + Iterables.toArray(allParams, String.class), environment, cwd.toFile()); //TODO(jlliu): have environment vars CommandRunner runner = new CommandRunner(cmd, timeout).withVerbose(verbose); return diff --git a/third_party/copybara/patches/0002-HgRepository-HGPLAIN.patch b/third_party/copybara/patches/0002-HgRepository-HGPLAIN.patch new file mode 100644 index 0000000000..43bdb5c4da --- /dev/null +++ b/third_party/copybara/patches/0002-HgRepository-HGPLAIN.patch @@ -0,0 +1,32 @@ +# HG changeset patch +# User Luke Granger-Brown +# Date 1589670391 -3600 +# Sun May 17 00:06:31 2020 +0100 +# Node ID ac30ad2187112d227da97d68c1996663fabfa1f6 +# Parent 478b958c38cb0d2e354076b55b21232f69af5fcc +third_party/copybara: patch HgRepository to use HGPLAIN + +diff --git a/java/com/google/copybara/hg/HgRepository.java b/java/com/google/copybara/hg/HgRepository.java +--- a/java/com/google/copybara/hg/HgRepository.java ++++ b/java/com/google/copybara/hg/HgRepository.java +@@ -51,6 +51,8 @@ import java.time.ZonedDateTime; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.List; ++import java.util.HashMap; ++import java.util.Map; + import javax.annotation.Nullable; + + /** +@@ -240,8 +242,10 @@ public class HgRepository { + List allParams = new ArrayList<>(Iterables.size(params) + 1); + allParams.add("hg"); //TODO(jlliu): resolve Hg binary here + Iterables.addAll(allParams, params); ++ Map environment = new HashMap<>(); ++ environment.put("HGPLAIN", ""); + Command cmd = new Command( +- Iterables.toArray(allParams, String.class), null, cwd.toFile()); ++ Iterables.toArray(allParams, String.class), environment, cwd.toFile()); + //TODO(jlliu): have environment vars + CommandRunner runner = new CommandRunner(cmd, timeout).withVerbose(verbose); + return