third_party/copybara: patch HgRepository to use HGPLAIN

This commit is contained in:
Luke Granger-Brown 2020-05-17 00:06:31 +01:00
parent b8fed98394
commit 32f5d4c104
3 changed files with 41 additions and 2 deletions

View file

@ -18,7 +18,10 @@ core.workflow(
),
authoring = authoring.pass_thru("Default email <noreply+copybara@lukegb.com>"),
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"),
],
)

View file

@ -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<String> allParams = new ArrayList<>(Iterables.size(params) + 1);
allParams.add("hg"); //TODO(jlliu): resolve Hg binary here
Iterables.addAll(allParams, params);
Map<String, String> 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

View file

@ -0,0 +1,32 @@
# HG changeset patch
# User Luke Granger-Brown <hg@lukegb.com>
# 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<String> allParams = new ArrayList<>(Iterables.size(params) + 1);
allParams.add("hg"); //TODO(jlliu): resolve Hg binary here
Iterables.addAll(allParams, params);
+ Map<String, String> 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