Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I414ade902dc38b696c566dd604000e3d289f3973
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
diff --git a/WORKSPACE b/WORKSPACE
index 8251578..f2fecb5 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -34,43 +34,43 @@
 )
 
 maven_jar(
-    name = "commons_codec",
+    name = "commons-codec",
     artifact = "commons-codec:commons-codec:1.4",
     sha1 = "4216af16d38465bbab0f3dff8efa14204f7a399a",
 )
 
 maven_jar(
-    name = "commons_logging",
+    name = "commons-logging",
     artifact = "commons-logging:commons-logging:1.1.3",
     sha1 = "f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f",
 )
 
 maven_jar(
-    name = "log_api",
+    name = "log-api",
     artifact = "org.slf4j:slf4j-api:1.7.2",
     sha1 = "0081d61b7f33ebeab314e07de0cc596f8e858d97",
 )
 
 maven_jar(
-    name = "slf4j_simple",
+    name = "slf4j-simple",
     artifact = "org.slf4j:slf4j-simple:1.7.2",
     sha1 = "760055906d7353ba4f7ce1b8908bc6b2e91f39fa",
 )
 
 maven_jar(
-    name = "servlet_api_3_1",
+    name = "servlet-api-3_1",
     artifact = "javax.servlet:javax.servlet-api:3.1.0",
     sha1 = "3cd63d075497751784b2fa84be59432f4905bf7c",
 )
 
 maven_jar(
-    name = "commons_compress",
+    name = "commons-compress",
     artifact = "org.apache.commons:commons-compress:1.6",
     sha1 = "c7d9b580aff9e9f1998361f16578e63e5c064699",
 )
 
 maven_jar(
-    name = "tukaani_xz",
+    name = "tukaani-xz",
     artifact = "org.tukaani:xz:1.3",
     sha1 = "66db21c8484120cb6a51b5b3ea47b6f383942bec",
 )
@@ -88,13 +88,13 @@
 )
 
 maven_jar(
-    name = "hamcrest_library",
+    name = "hamcrest-library",
     artifact = "org.hamcrest:hamcrest-library:1.3",
     sha1 = "4785a3c21320980282f9f33d0d1264a69040538f",
 )
 
 maven_jar(
-    name = "hamcrest_core",
+    name = "hamcrest-core",
     artifact = "org.hamcrest:hamcrest-core:1.3",
     sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
 )
@@ -108,42 +108,42 @@
 JETTY_VER = "9.4.5.v20170502"
 
 maven_jar(
-    name = "jetty_servlet",
+    name = "jetty-servlet",
     artifact = "org.eclipse.jetty:jetty-servlet:" + JETTY_VER,
     sha1 = "394a535b76ca7399b25be3266f06f614e020517e",
     src_sha1 = "4e85803c8d539aa0a8389e113095ef86032ac425",
 )
 
 maven_jar(
-    name = "jetty_security",
+    name = "jetty-security",
     artifact = "org.eclipse.jetty:jetty-security:" + JETTY_VER,
     sha1 = "4f4fc4cbe3504b6c91143ee37b38a1f3de2dcc72",
     src_sha1 = "2124a757c87eacea7ad6507be6a415b5b51139b5",
 )
 
 maven_jar(
-    name = "jetty_server",
+    name = "jetty-server",
     artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VER,
     sha1 = "b4d30340213c3d2a5f908860ba170c5a697829be",
     src_sha1 = "295d873f609a0e2863f33b5dbc8906ca348f1107",
 )
 
 maven_jar(
-    name = "jetty_http",
+    name = "jetty-http",
     artifact = "org.eclipse.jetty:jetty-http:" + JETTY_VER,
     sha1 = "c51b8a6a67d64672889249dd958edd77bff8fc0c",
     src_sha1 = "c1bee39aeb565a4f26852b1851192d98ab611dbc",
 )
 
 maven_jar(
-    name = "jetty_io",
+    name = "jetty-io",
     artifact = "org.eclipse.jetty:jetty-io:" + JETTY_VER,
     sha1 = "76086f955d4e943396b8f340fd5bae3ce4da19d9",
     src_sha1 = "8d41e410b2f0dd284a6e199ed08f45ef7ab2acf1",
 )
 
 maven_jar(
-    name = "jetty_util",
+    name = "jetty-util",
     artifact = "org.eclipse.jetty:jetty-util:" + JETTY_VER,
     sha1 = "5fd36dfcf39110b809bd9b20cec62706ab694711",
     src_sha1 = "629fcda1e4eecfd795e24cc07715ab9797970980",
diff --git a/lib/BUILD b/lib/BUILD
index 827e6b6..346e1fd 100644
--- a/lib/BUILD
+++ b/lib/BUILD
@@ -13,19 +13,19 @@
         "//org.eclipse.jgit.archive:__pkg__",
         "//org.eclipse.jgit.pgm.test:__pkg__",
     ],
-    exports = ["@commons_compress//jar"],
+    exports = ["@commons-compress//jar"],
 )
 
 java_library(
     name = "commons-codec",
-    exports = ["@commons_codec//jar"],
+    exports = ["@commons-codec//jar"],
 )
 
 java_library(
     name = "commons-logging",
     testonly = 1,
     visibility = ["//visibility:public"],
-    exports = ["@commons_logging//jar"],
+    exports = ["@commons-logging//jar"],
 )
 
 java_library(
@@ -65,7 +65,7 @@
     name = "jetty-http",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_http//jar"],
+    exports = ["@jetty-http//jar"],
     runtime_deps = [":commons-codec"],
 )
 
@@ -73,35 +73,35 @@
     name = "jetty-io",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_io//jar"],
+    exports = ["@jetty-io//jar"],
 )
 
 java_library(
     name = "jetty-security",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_security//jar"],
+    exports = ["@jetty-security//jar"],
 )
 
 java_library(
     name = "jetty-server",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_server//jar"],
+    exports = ["@jetty-server//jar"],
 )
 
 java_library(
     name = "jetty-servlet",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_servlet//jar"],
+    exports = ["@jetty-servlet//jar"],
 )
 
 java_library(
     name = "jetty-util",
     # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it.
     visibility = ["//visibility:public"],
-    exports = ["@jetty_util//jar"],
+    exports = ["@jetty-util//jar"],
 )
 
 java_library(
@@ -115,9 +115,9 @@
     testonly = 1,
     visibility = ["//visibility:public"],
     exports = [
-       "@junit//jar",
-       "@hamcrest_core//jar",
-       "@hamcrest_library//jar",
+        "@hamcrest-core//jar",
+        "@hamcrest-library//jar",
+        "@junit//jar",
     ],
 )
 
@@ -132,25 +132,25 @@
         "//org.eclipse.jgit.lfs.server.test:__pkg__",
         "//org.eclipse.jgit.pgm:__pkg__",
     ],
-    exports = ["@servlet_api_3_1//jar"],
+    exports = ["@servlet-api-3_1//jar"],
 )
 
 java_library(
     name = "slf4j-api",
     visibility = ["//visibility:public"],
-    exports = ["@log_api//jar"],
+    exports = ["@log-api//jar"],
 )
 
 java_library(
     name = "slf4j-simple",
     testonly = 1,
     visibility = ["//visibility:public"],
-    exports = ["@slf4j_simple//jar"],
+    exports = ["@slf4j-simple//jar"],
 )
 
 java_library(
     name = "xz",
     testonly = 1,
     visibility = ["//visibility:public"],
-    exports = ["@tukaani_xz//jar"],
+    exports = ["@tukaani-xz//jar"],
 )
diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD
index ae6f242..bbda838 100644
--- a/org.eclipse.jgit.test/BUILD
+++ b/org.eclipse.jgit.test/BUILD
@@ -33,7 +33,7 @@
 
 tests(glob(
     ["tst/**/*.java"],
-    exclude = HELPERS + DATA
+    exclude = HELPERS + DATA,
 ))
 
 java_library(
@@ -54,8 +54,8 @@
 )
 
 genrule2(
-  name = 'tst_rsrc_jar',
-  cmd = 'o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd  $$TMP && zip -qr $$o .',
-  srcs = glob(['tst-rsrc/**']),
-  outs = ['tst_rsrc.jar',],
+    name = "tst_rsrc_jar",
+    srcs = glob(["tst-rsrc/**"]),
+    outs = ["tst_rsrc.jar"],
+    cmd = "o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd  $$TMP && zip -qr $$o .",
 )
diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl
index 9cadc74..8ae0065 100644
--- a/org.eclipse.jgit.test/tests.bzl
+++ b/org.eclipse.jgit.test/tests.bzl
@@ -4,45 +4,45 @@
 )
 
 def tests(tests):
-  for src in tests:
-    name = src[len('tst/'):len(src)-len('.java')].replace('/', '_')
-    labels = []
-    if name.startswith('org_eclipse_jgit_'):
-      l = name[len('org.eclipse.jgit_'):]
-      if l.startswith('internal_storage_'):
-        l = l[len('internal.storage_'):]
-      i = l.find('_')
-      if i > 0:
-        labels.append(l[:i])
-      else:
-        labels.append(i)
-    if 'lib' not in labels:
-      labels.append('lib')
+    for src in tests:
+        name = src[len("tst/"):len(src) - len(".java")].replace("/", "_")
+        labels = []
+        if name.startswith("org_eclipse_jgit_"):
+            l = name[len("org.eclipse.jgit_"):]
+            if l.startswith("internal_storage_"):
+                l = l[len("internal.storage_"):]
+            i = l.find("_")
+            if i > 0:
+                labels.append(l[:i])
+            else:
+                labels.append(i)
+        if "lib" not in labels:
+            labels.append("lib")
 
-    additional_deps = []
-    if src.endswith("RootLocaleTest.java"):
-      additional_deps = [
-        '//org.eclipse.jgit.pgm:pgm',
-        '//org.eclipse.jgit.ui:ui',
-      ]
-    if src.endswith("WalkEncryptionTest.java"):
-      additional_deps = [
-        '//org.eclipse.jgit:insecure_cipher_factory',
-      ]
+        additional_deps = []
+        if src.endswith("RootLocaleTest.java"):
+            additional_deps = [
+                "//org.eclipse.jgit.pgm:pgm",
+                "//org.eclipse.jgit.ui:ui",
+            ]
+        if src.endswith("WalkEncryptionTest.java"):
+            additional_deps = [
+                "//org.eclipse.jgit:insecure_cipher_factory",
+            ]
 
-    junit_tests(
-      name = name,
-      tags = labels,
-      srcs = [src],
-      deps = additional_deps + [
-        ':helpers',
-        ':tst_rsrc',
-        '//lib:javaewah',
-        '//lib:junit',
-        '//lib:slf4j-api',
-        '//org.eclipse.jgit:jgit',
-        '//org.eclipse.jgit.junit:junit',
-        '//org.eclipse.jgit.lfs:jgit-lfs',
-      ],
-      jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"],
-    )
+        junit_tests(
+            name = name,
+            tags = labels,
+            srcs = [src],
+            deps = additional_deps + [
+                ":helpers",
+                ":tst_rsrc",
+                "//lib:javaewah",
+                "//lib:junit",
+                "//lib:slf4j-api",
+                "//org.eclipse.jgit:jgit",
+                "//org.eclipse.jgit.junit:junit",
+                "//org.eclipse.jgit.lfs:jgit-lfs",
+            ],
+            jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"],
+        )
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java
index aaeb79c..6fed233 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java
@@ -583,23 +583,6 @@
 						SOB1));
 	}
 
-	public void notestCommitDashV() throws Exception {
-		assertEquals("a\n" + //
-				"\n" + //
-				"Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" + //
-				SOB1 + //
-				SOB2, //
-				call("a\n" + //
-						"\n" + //
-						SOB1 + //
-						SOB2 + //
-						"\n" + //
-						"# on branch master\n" + //
-						"diff --git a/src b/src\n" + //
-						"new file mode 100644\n" + //
-						"index 0000000..c78b7f0\n"));
-	}
-
 	@Test
 	public void testWithEndingURL() throws Exception {
 		assertEquals("a\n" + //
diff --git a/tools/bazlets.bzl b/tools/bazlets.bzl
index e14e488..f97b72c 100644
--- a/tools/bazlets.bzl
+++ b/tools/bazlets.bzl
@@ -1,17 +1,16 @@
 NAME = "com_googlesource_gerrit_bazlets"
 
 def load_bazlets(
-    commit,
-    local_path = None
-  ):
-  if not local_path:
-      native.git_repository(
-          name = NAME,
-          remote = "https://gerrit.googlesource.com/bazlets",
-          commit = commit,
-      )
-  else:
-      native.local_repository(
-          name = NAME,
-          path = local_path,
-      )
+        commit,
+        local_path = None):
+    if not local_path:
+        native.git_repository(
+            name = NAME,
+            remote = "https://gerrit.googlesource.com/bazlets",
+            commit = commit,
+        )
+    else:
+        native.local_repository(
+            name = NAME,
+            path = local_path,
+        )