Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Bump Bazel version to 3.7.0
  Upgrade bazlets to latest stable-3.0 to build with 3.0.13 API

Change-Id: I651be39f724d66141e1284be3bc37c70e482d255
diff --git a/.bazelrc b/.bazelrc
deleted file mode 100644
index 6e4e0ba..0000000
--- a/.bazelrc
+++ /dev/null
@@ -1,3 +0,0 @@
-build --workspace_status_command="python ./tools/workspace_status.py"
-test --build_tests_only
-
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index a4ec9de..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/.classpath
-/.project
-/.settings
-/bazel-bin
-/bazel-out
-/bazel-lfs
-/bazel-testlogs
-/eclipse-out
diff --git a/BUILD b/BUILD
index 81ab40d..d00bb76 100644
--- a/BUILD
+++ b/BUILD
@@ -7,9 +7,30 @@
     "gerrit_plugin",
 )
 
+LFS_DEPS = [
+    "@jgit//org.eclipse.jgit.lfs.server:jgit-lfs-server",
+    "@jgit//org.eclipse.jgit.lfs:jgit-lfs",
+]
+
+DEPLOY_ENV = [
+    "//lib:gson",
+    "//lib/httpcomponents:httpclient",
+    "//lib:jgit",
+    "//lib:servlet-api-without-neverlink",
+]
+
+# TODO(davido): Remove this workaround, when provided_deps attribute is added:
+# https://github.com/bazelbuild/bazel/issues/1402
+java_binary(
+    name = "gerrit_core_provided_env",
+    main_class = "Dummy",
+    runtime_deps = DEPLOY_ENV,
+)
+
 gerrit_plugin(
     name = "lfs",
     srcs = glob(["src/main/java/**/*.java"]),
+    deploy_env = ["gerrit_core_provided_env"],
     manifest_entries = [
         "Gerrit-PluginName: lfs",
         "Gerrit-Module: com.googlesource.gerrit.plugins.lfs.Module",
@@ -18,11 +39,7 @@
         "Gerrit-InitStep: com.googlesource.gerrit.plugins.lfs.InitLfs",
     ],
     resources = glob(["src/main/resources/**/*"]),
-    deps = [
-        "@jgit-http-apache//jar",
-        "@jgit-lfs-server//jar",
-        "@jgit-lfs//jar",
-    ],
+    deps = LFS_DEPS,
 )
 
 junit_tests(
@@ -38,8 +55,7 @@
     name = "lfs__plugin_test_deps",
     testonly = 1,
     visibility = ["//visibility:public"],
-    exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+    exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + LFS_DEPS + [
         ":lfs__plugin",
-        "@jgit-lfs//jar",
     ],
 )
diff --git a/WORKSPACE b/WORKSPACE
deleted file mode 100644
index 36aeb9e..0000000
--- a/WORKSPACE
+++ /dev/null
@@ -1,19 +0,0 @@
-workspace(name = "lfs")
-
-load("//:bazlets.bzl", "load_bazlets")
-
-load_bazlets(
-    commit = "a010a539824bd467059f414412a47b80101352d7",
-    #local_path = "/home/<user>/projects/bazlets",
-)
-
-load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
-    "gerrit_api",
-)
-
-gerrit_api()
-
-load(":external_plugin_deps.bzl", "external_plugin_deps")
-
-external_plugin_deps()
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
deleted file mode 100644
index 1b3231e..0000000
--- a/external_plugin_deps.bzl
+++ /dev/null
@@ -1,38 +0,0 @@
-load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar")
-
-JGIT_VERSION = "5.3.7.202002110540-r"
-REPO = MAVEN_CENTRAL
-
-def external_plugin_deps():
-    maven_jar(
-        name = "jgit-http-apache",
-        artifact = "org.eclipse.jgit:org.eclipse.jgit.http.apache:" + JGIT_VERSION,
-        sha1 = "2a7795f4af2589c4dfeb5fedca4ebe3985d350e0",
-        repository = REPO,
-        exclude = [
-            "about.html",
-            "plugin.properties",
-        ],
-    )
-
-    maven_jar(
-        name = "jgit-lfs",
-        artifact = "org.eclipse.jgit:org.eclipse.jgit.lfs:" + JGIT_VERSION,
-        sha1 = "09c56d0c76823dd59c31b4843aa6782d1811303a",
-        repository = REPO,
-        exclude = [
-            "about.html",
-            "plugin.properties",
-        ],
-    )
-
-    maven_jar(
-        name = "jgit-lfs-server",
-        artifact = "org.eclipse.jgit:org.eclipse.jgit.lfs.server:" + JGIT_VERSION,
-        sha1 = "10fd5160ef668c9c55b32cce1cbf8507c03c2c1a",
-        repository = REPO,
-        exclude = [
-            "about.html",
-            "plugin.properties",
-        ],
-    )
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsGlobalConfig.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsGlobalConfig.java
index ebbc81c..1db9358 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsGlobalConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsGlobalConfig.java
@@ -15,6 +15,7 @@
 package com.googlesource.gerrit.plugins.lfs;
 
 import com.google.common.collect.Maps;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.extensions.restapi.RestReadView;
 import com.google.gerrit.server.project.ProjectResource;
@@ -35,7 +36,7 @@
   }
 
   @Override
-  public LfsGlobalConfigInfo apply(ProjectResource resource) throws RestApiException {
+  public Response<LfsGlobalConfigInfo> apply(ProjectResource resource) throws RestApiException {
     adminView.validate(resource);
 
     LfsGlobalConfigInfo info = new LfsGlobalConfigInfo();
@@ -56,6 +57,6 @@
         info.namespaces.put(section.getNamespace(), sectionInfo);
       }
     }
-    return info;
+    return Response.ok(info);
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsProjectConfig.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsProjectConfig.java
index 07c1d7d..c445d77 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsProjectConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsProjectConfig.java
@@ -14,6 +14,7 @@
 
 package com.googlesource.gerrit.plugins.lfs;
 
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.extensions.restapi.RestReadView;
 import com.google.gerrit.server.project.ProjectResource;
@@ -31,7 +32,7 @@
   }
 
   @Override
-  public LfsProjectConfigInfo apply(ProjectResource resource) throws RestApiException {
+  public Response<LfsProjectConfigInfo> apply(ProjectResource resource) throws RestApiException {
     LfsProjectConfigInfo info = new LfsProjectConfigInfo();
     LfsProjectConfigSection config =
         lfsConfigFactory.getProjectsConfig().getForProject(resource.getNameKey());
@@ -41,6 +42,6 @@
       info.readOnly = config.isReadOnly();
       info.backend = config.getBackend();
     }
-    return info;
+    return Response.ok(info);
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java
index 992dada..772a536 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java
@@ -22,7 +22,7 @@
 import static com.google.gerrit.server.permissions.ProjectPermission.PUSH_AT_LEAST_ONE_REF;
 
 import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.ProjectUtil;
 import com.google.gerrit.server.permissions.PermissionBackend;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsProjectsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsProjectsConfig.java
index ea5e076..3263c1a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsProjectsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsProjectsConfig.java
@@ -14,12 +14,12 @@
 
 package com.googlesource.gerrit.plugins.lfs;
 
-import static com.google.gerrit.reviewdb.client.RefNames.REFS_CONFIG;
+import static com.google.gerrit.entities.RefNames.REFS_CONFIG;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.annotations.PluginName;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.config.AllProjectsName;
 import com.google.gerrit.server.git.meta.VersionedMetaData;
 import com.google.gerrit.server.project.ProjectCache;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsRepositoryResolver.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsRepositoryResolver.java
index 59cdb13..0d3b705 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsRepositoryResolver.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsRepositoryResolver.java
@@ -16,7 +16,7 @@
 
 import com.google.common.base.Strings;
 import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.inject.Inject;
 import java.util.Map;
 import org.eclipse.jgit.lfs.errors.LfsRepositoryNotFound;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/PutLfsGlobalConfig.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/PutLfsGlobalConfig.java
index ea4e44e..de66bbb 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/PutLfsGlobalConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/PutLfsGlobalConfig.java
@@ -20,12 +20,13 @@
 import static com.googlesource.gerrit.plugins.lfs.LfsProjectConfigSection.KEY_READ_ONLY;
 
 import com.google.common.base.Strings;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.restapi.ResourceConflictException;
 import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.git.meta.MetaDataUpdate;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.inject.Inject;
@@ -63,7 +64,7 @@
   }
 
   @Override
-  public LfsGlobalConfigInfo apply(ProjectResource resource, LfsGlobalConfigInput input)
+  public Response<LfsGlobalConfigInfo> apply(ProjectResource resource, LfsGlobalConfigInput input)
       throws RestApiException {
     adminView.validate(resource);
     Project.NameKey projectName = resource.getNameKey();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsGetLocksAction.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsGetLocksAction.java
index a84d458..48dceea 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsGetLocksAction.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsGetLocksAction.java
@@ -19,8 +19,8 @@
 import static com.google.gerrit.server.permissions.ProjectPermission.ACCESS;
 
 import com.google.common.base.Strings;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.restapi.AuthException;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.permissions.PermissionBackend;
 import com.google.gerrit.server.permissions.PermissionBackend.ForProject;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java
index 32536f7..b8a6f14 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java
@@ -22,8 +22,9 @@
 import static org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION;
 
 import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.exceptions.StorageException;
 import com.google.gerrit.extensions.restapi.AuthException;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.ProjectUtil;
 import com.google.gerrit.server.permissions.PermissionBackend;
@@ -71,7 +72,10 @@
       String name = getProjectName();
       ProjectState project = getProject(name);
       CurrentUser user = getUser(name);
-      ProjectState state = projectCache.checkedGet(project.getNameKey());
+      ProjectState state = projectCache.get(project.getNameKey());
+      if (state == null) {
+        throw new LfsRepositoryNotFound(project.getNameKey().get());
+      }
       try {
         authorizeUser(permissionBackend.user(user).project(state.getNameKey()));
       } catch (AuthException | PermissionBackendException e) {
@@ -84,7 +88,7 @@
       context.sendError(SC_NOT_FOUND, e.getMessage());
     } catch (LfsLockExistsException e) {
       context.sendError(SC_CONFLICT, e.error);
-    } catch (LfsException e) {
+    } catch (LfsException | StorageException e) {
       context.sendError(SC_INTERNAL_SERVER_ERROR, e.getMessage());
     }
   }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksHandler.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksHandler.java
index 66ee924..932a92d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksHandler.java
@@ -20,7 +20,7 @@
 import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableList;
 import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.cache.CacheModule;
 import com.google.inject.Inject;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsProjectLocks.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsProjectLocks.java
index e8987f9..8c0345c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsProjectLocks.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsProjectLocks.java
@@ -17,7 +17,7 @@
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 5bd6251..630b0d6 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -3,48 +3,7 @@
 
 This @PLUGIN@ plugin is built with Bazel.
 
-Two build modes are supported: Standalone and in Gerrit tree.
-The standalone build mode is recommended, as this mode doesn't require
-the Gerrit tree to exist locally.
-
-### Build standalone
-
-```
-  bazel build @PLUGIN@
-```
-
-The output is created in
-
-```
-  bazel-bin/@PLUGIN@.jar
-```
-
-To execute the tests run:
-
-```
-  bazel test //...
-```
-
-This project can be imported into the Eclipse IDE. Execute:
-
-```
-  ./tools/eclipse/project.sh
-```
-
-to generate the required files and then import the project.
-
-### Build in Gerrit tree
-
-Put the external dependency Bazel build file into the Gerrit /plugins directory,
-replacing the existing empty one.
-
-```
-  cd gerrit/plugins
-  rm external_plugin_deps.bzl
-  ln -s @PLUGIN@/external_plugin_deps.bzl .
-```
-
-Then issue
+Link the plugin directory in plugins directory in Gerrit core and run
 
 ```
   bazel build plugins/@PLUGIN@
@@ -76,4 +35,4 @@
 
 [Back to @PLUGIN@ documentation index][index]
 
-[index]: index.html
\ No newline at end of file
+[index]: index.html
diff --git a/src/test/java/com/googlesource/gerrit/plugins/lfs/LfsIT.java b/src/test/java/com/googlesource/gerrit/plugins/lfs/LfsIT.java
index c71a83c..a3c77a3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/lfs/LfsIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/lfs/LfsIT.java
@@ -16,7 +16,7 @@
 
 import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
 import com.google.gerrit.acceptance.TestPlugin;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.testing.ConfigSuite;
 import org.eclipse.jgit.lib.Config;
 import org.junit.Test;
diff --git a/tools/BUILD b/tools/BUILD
deleted file mode 100644
index 1fa2160..0000000
--- a/tools/BUILD
+++ /dev/null
@@ -1 +0,0 @@
-# Empty file - bazel treat directories with BUILD file as a package
\ No newline at end of file
diff --git a/tools/bzl/BUILD b/tools/bzl/BUILD
deleted file mode 100644
index c5ed0b7..0000000
--- a/tools/bzl/BUILD
+++ /dev/null
@@ -1 +0,0 @@
-# Empty file required by Bazel
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
deleted file mode 100644
index c921d01..0000000
--- a/tools/bzl/classpath.bzl
+++ /dev/null
@@ -1,6 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//tools:classpath.bzl",
-    _classpath_collector = "classpath_collector",
-)
-
-classpath_collector = _classpath_collector
diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl
deleted file mode 100644
index 97307bd..0000000
--- a/tools/bzl/junit.bzl
+++ /dev/null
@@ -1,6 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
-    _junit_tests = "junit_tests",
-)
-
-junit_tests = _junit_tests
diff --git a/tools/bzl/maven_jar.bzl b/tools/bzl/maven_jar.bzl
deleted file mode 100644
index fb20419..0000000
--- a/tools/bzl/maven_jar.bzl
+++ /dev/null
@@ -1,12 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl",
-    _gerrit = "GERRIT",
-    _maven_central = "MAVEN_CENTRAL",
-    _maven_jar = "maven_jar",
-    _maven_local = "MAVEN_LOCAL",
-)
-
-GERRIT = _gerrit
-MAVEN_CENTRAL = _maven_central
-MAVEN_LOCAL = _maven_local
-maven_jar = _maven_jar
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl
deleted file mode 100644
index 4d2dbdd..0000000
--- a/tools/bzl/plugin.bzl
+++ /dev/null
@@ -1,10 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
-    _gerrit_plugin = "gerrit_plugin",
-    _plugin_deps = "PLUGIN_DEPS",
-    _plugin_test_deps = "PLUGIN_TEST_DEPS",
-)
-
-gerrit_plugin = _gerrit_plugin
-PLUGIN_DEPS = _plugin_deps
-PLUGIN_TEST_DEPS = _plugin_test_deps
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
deleted file mode 100644
index 56fe7de..0000000
--- a/tools/eclipse/BUILD
+++ /dev/null
@@ -1,9 +0,0 @@
-load("//tools/bzl:classpath.bzl", "classpath_collector")
-
-classpath_collector(
-    name = "main_classpath_collect",
-    testonly = 1,
-    deps = [
-        "//:lfs__plugin_test_deps",
-    ],
-)
diff --git a/tools/eclipse/project.sh b/tools/eclipse/project.sh
deleted file mode 100755
index 2e79913..0000000
--- a/tools/eclipse/project.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-`bazel query @com_googlesource_gerrit_bazlets//tools/eclipse:project --output location | sed s/BUILD:.*//`project.py -n lfs -r .
diff --git a/tools/workspace_status.py b/tools/workspace_status.py
deleted file mode 100644
index fbb98ef..0000000
--- a/tools/workspace_status.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-# This script will be run by bazel when the build process starts to
-# generate key-value information that represents the status of the
-# workspace. The output should be like
-#
-# KEY1 VALUE1
-# KEY2 VALUE2
-#
-# If the script exits with non-zero code, it's considered as a failure
-# and the output will be discarded.
-
-from __future__ import print_function
-import subprocess
-import sys
-
-CMD = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty']
-
-
-def revision():
-    try:
-        return subprocess.check_output(CMD).strip().decode("utf-8")
-    except OSError as err:
-        print('could not invoke git: %s' % err, file=sys.stderr)
-        sys.exit(1)
-    except subprocess.CalledProcessError as err:
-        print('error using git: %s' % err, file=sys.stderr)
-        sys.exit(1)
-
-
-print("STABLE_BUILD_LFS_LABEL %s" % revision())