Repository: iterative/dvc

I have access to a python code repository in the directory /testbed . You can explore and modify files using the available tools. Consider the following issue description:

<issue_description>
brancher: rename `working tree` -> `workspace`
Much more natural term. Was also noted by @dmpetrov while working with plots. Needed for cml release.
</issue_description>

Can you help me implement the necessary changes to the repository so that the requirements specified in the <issue_description> are met?
I've already taken care of all changes to any of the test files described in the <issue_description>. This means you DON'T have to modify the testing logic or any of the tests in any way!
Also the development Python environment is already set up for you (i.e., all dependencies already installed), so you don't need to install other packages.
Your task is to make the minimal changes to non-test files in the /testbed directory to ensure the <issue_description> is satisfied.

Follow these phases to resolve the issue:

Phase 1. READING: read the problem and reword it in clearer terms
   1.1 If there are code or config snippets. Express in words any best practices or conventions in them.
   1.2 Hightlight message errors, method names, variables, file names, stack traces, and technical details.
   1.3 Explain the problem in clear terms.
   1.4 Enumerate the steps to reproduce the problem.
   1.5 Hightlight any best practices to take into account when testing and fixing the issue

Phase 2. RUNNING: install and run the tests on the repository
   2.1 Activate the environment by running  
       ./opt/miniconda3/etc/profile.d/conda.sh ; conda activate testbed
   2.2 Follow the readme
   2.3 Install the environment and anything needed
   2.4 Iterate and figure out how to run the tests

Phase 3. EXPLORATION: find the files that are related to the problem and possible solutions
   3.1 Use `grep` to search for relevant methods, classes, keywords and error messages.
   3.2 Identify all files related to the problem statement.
   3.3 Propose the methods and files to fix the issue and explain why.
   3.4 From the possible file locations, select the most likely location to fix the issue.

Phase 4. TEST CREATION: before implementing any fix, create a script to reproduce and verify the issue.
   4.1 Look at existing test files in the repository to understand the test format/structure.
   4.2 Create a minimal reproduction script that reproduces the located issue.
   4.3 Run the reproduction script to confirm you are reproducing the issue.
   4.4 Adjust the reproduction script as necessary.

Phase 5. FIX ANALYSIS: state clearly the problem and how to fix it
   5.1 State clearly what the problem is.
   5.2 State clearly where the problem is located.
   5.3 State clearly how the test reproduces the issue.
   5.4 State clearly the best practices to take into account in the fix.
   5.5 State clearly how to fix the problem.

Phase 6. FIX IMPLEMENTATION: Edit the source code to implement your chosen solution.
   6.1 Make minimal, focused changes to fix the issue.

Phase 7. VERIFICATION: Test your implementation thoroughly.
   7.1 Run your reproduction script to verify the fix works.
   7.2 Add edge cases to your test script to ensure comprehensive coverage.
   7.3 Run existing tests related to the modified code to ensure you haven't broken anything.

8. FINAL REVIEW: Carefully re-read the problem description and compare your changes with the base commit 516d82e41107438756797611bbb15614cd4d989f.
   8.1 Ensure you've fully addressed all requirements.
   8.2 Run any tests in the repository related to:
     8.2.1 The issue you are fixing
     8.2.2 The files you modified
     8.2.3 The functions you changed
   8.3 If any tests fail, revise your implementation until all tests pass

Be thorough in your exploration, testing, and reasoning. It's fine if your thinking process is lengthy - quality and completeness are more important than brevity.

Gold patch:
diff --git a/dvc/command/gc.py b/dvc/command/gc.py
--- a/dvc/command/gc.py
+++ b/dvc/command/gc.py
@@ -21,7 +21,7 @@ def run(self):
 
         msg = "This will remove all cache except items used in "
 
-        msg += "the working tree"
+        msg += "the workspace"
         if self.args.all_commits:
             msg += " and all git commits"
         elif self.args.all_branches and self.args.all_tags:
@@ -77,7 +77,7 @@ def add_parser(subparsers, parent_parser):
         "--workspace",
         action="store_true",
         default=False,
-        help="Keep data files used in the current workspace (working tree).",
+        help="Keep data files used in the current workspace.",
     )
     gc_parser.add_argument(
         "-a",
diff --git a/dvc/repo/brancher.py b/dvc/repo/brancher.py
--- a/dvc/repo/brancher.py
+++ b/dvc/repo/brancher.py
@@ -18,7 +18,7 @@ def brancher(  # noqa: E302
         str: the display name for the currently selected tree, it could be:
             - a git revision identifier
             - empty string it there is no branches to iterate over
-            - "Working Tree" if there are uncommitted changes in the SCM repo
+            - "workspace" if there are uncommitted changes in the SCM repo
     """
     if not any([revs, all_branches, all_tags, all_commits]):
         yield ""
@@ -30,10 +30,10 @@ def brancher(  # noqa: E302
     scm = self.scm
 
     self.tree = WorkingTree(self.root_dir)
-    yield "working tree"
+    yield "workspace"
 
-    if revs and "working tree" in revs:
-        revs.remove("working tree")
+    if revs and "workspace" in revs:
+        revs.remove("workspace")
 
     if all_commits:
         revs = scm.list_all_commits()
diff --git a/dvc/repo/diff.py b/dvc/repo/diff.py
--- a/dvc/repo/diff.py
+++ b/dvc/repo/diff.py
@@ -7,7 +7,7 @@
 @locked
 def diff(self, a_rev="HEAD", b_rev=None):
     """
-    By default, it compares the working tree with the last commit's tree.
+    By default, it compares the workspace with the last commit's tree.
 
     This implementation differs from `git diff` since DVC doesn't have
     the concept of `index`, but it keeps the same interface, thus,
diff --git a/dvc/repo/metrics/show.py b/dvc/repo/metrics/show.py
--- a/dvc/repo/metrics/show.py
+++ b/dvc/repo/metrics/show.py
@@ -104,13 +104,13 @@ def show(
     if not res:
         raise NoMetricsError()
 
-    # Hide working tree metrics if they are the same as in the active branch
+    # Hide workspace metrics if they are the same as in the active branch
     try:
         active_branch = repo.scm.active_branch()
     except TypeError:
         pass  # Detached head
     else:
-        if res.get("working tree") == res.get(active_branch):
-            res.pop("working tree", None)
+        if res.get("workspace") == res.get(active_branch):
+            res.pop("workspace", None)
 
     return res
diff --git a/dvc/repo/params/show.py b/dvc/repo/params/show.py
--- a/dvc/repo/params/show.py
+++ b/dvc/repo/params/show.py
@@ -58,13 +58,13 @@ def show(repo, revs=None):
     if not res:
         raise NoParamsError("no parameter configs files in this repository")
 
-    # Hide working tree params if they are the same as in the active branch
+    # Hide workspace params if they are the same as in the active branch
     try:
         active_branch = repo.scm.active_branch()
     except TypeError:
         pass  # Detached head
     else:
-        if res.get("working tree") == res.get(active_branch):
-            res.pop("working tree", None)
+        if res.get("workspace") == res.get(active_branch):
+            res.pop("workspace", None)
 
     return res
diff --git a/dvc/repo/plots/data.py b/dvc/repo/plots/data.py
--- a/dvc/repo/plots/data.py
+++ b/dvc/repo/plots/data.py
@@ -258,7 +258,7 @@ def _load_from_revisions(repo, datafile, revisions):
     exceptions = []
 
     for rev in repo.brancher(revs=revisions):
-        if rev == "working tree" and rev not in revisions:
+        if rev == "workspace" and rev not in revisions:
             continue
 
         try:
diff --git a/dvc/repo/plots/diff.py b/dvc/repo/plots/diff.py
--- a/dvc/repo/plots/diff.py
+++ b/dvc/repo/plots/diff.py
@@ -3,7 +3,7 @@ def _revisions(revs, is_dirty):
     if len(revisions) <= 1:
         if len(revisions) == 0 and is_dirty:
             revisions.append("HEAD")
-        revisions.append("working tree")
+        revisions.append("workspace")
     return revisions
 
 
diff --git a/dvc/repo/plots/show.py b/dvc/repo/plots/show.py
--- a/dvc/repo/plots/show.py
+++ b/dvc/repo/plots/show.py
@@ -106,7 +106,7 @@ def _infer_y_field(rev_data_points, x_field):
 
 def _show(repo, datafile=None, revs=None, props=None):
     if revs is None:
-        revs = ["working tree"]
+        revs = ["workspace"]
 
     if not datafile and not props.get("template"):
         raise NoDataOrTemplateProvided()


Test patch:
diff --git a/tests/func/metrics/test_show.py b/tests/func/metrics/test_show.py
--- a/tests/func/metrics/test_show.py
+++ b/tests/func/metrics/test_show.py
@@ -56,7 +56,7 @@ def test_show_branch(tmp_dir, scm, dvc, run_copy_metrics):
         tmp_dir.scm_gen("metrics.yaml", "foo: 2", commit="branch")
 
     assert dvc.metrics.show(revs=["branch"]) == {
-        "working tree": {"metrics.yaml": {"foo": 1}},
+        "workspace": {"metrics.yaml": {"foo": 1}},
         "branch": {"metrics.yaml": {"foo": 2}},
     }
 
@@ -90,6 +90,6 @@ def test_show_subrepo_with_preexisting_tags(tmp_dir, scm):
 
     expected_path = os.path.join("subdir", "metrics.yaml")
     assert dvc.metrics.show(all_tags=True) == {
-        "working tree": {expected_path: {"foo": 1}},
+        "workspace": {expected_path: {"foo": 1}},
         "v1": {expected_path: {"foo": 1}},
     }
diff --git a/tests/func/params/test_show.py b/tests/func/params/test_show.py
--- a/tests/func/params/test_show.py
+++ b/tests/func/params/test_show.py
@@ -49,7 +49,7 @@ def test_show_branch(tmp_dir, scm, dvc):
         tmp_dir.scm_gen("params.yaml", "foo: baz", commit="branch")
 
     assert dvc.params.show(revs=["branch"]) == {
-        "working tree": {"params.yaml": {"foo": "bar"}},
+        "workspace": {"params.yaml": {"foo": "bar"}},
         "branch": {"params.yaml": {"foo": "baz"}},
     }
 
diff --git a/tests/func/plots/test_diff.py b/tests/func/plots/test_diff.py
--- a/tests/func/plots/test_diff.py
+++ b/tests/func/plots/test_diff.py
@@ -32,8 +32,8 @@ def test_diff_dirty(tmp_dir, scm, dvc, run_copy_metrics):
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"y": 5, PlotData.INDEX_FIELD: 0, "rev": "working tree"},
-        {"y": 6, PlotData.INDEX_FIELD: 1, "rev": "working tree"},
+        {"y": 5, PlotData.INDEX_FIELD: 0, "rev": "workspace"},
+        {"y": 6, PlotData.INDEX_FIELD: 1, "rev": "workspace"},
         {"y": 3, PlotData.INDEX_FIELD: 0, "rev": "HEAD"},
         {"y": 5, PlotData.INDEX_FIELD: 1, "rev": "HEAD"},
     ]
diff --git a/tests/func/plots/test_plots.py b/tests/func/plots/test_plots.py
--- a/tests/func/plots/test_plots.py
+++ b/tests/func/plots/test_plots.py
@@ -60,8 +60,8 @@ def test_plot_csv_one_column(tmp_dir, scm, dvc, run_copy_metrics):
     plot_content = json.loads(plot_string)
     assert plot_content["title"] == "mytitle"
     assert plot_content["data"]["values"] == [
-        {"0": "2", PlotData.INDEX_FIELD: 0, "rev": "working tree"},
-        {"0": "3", PlotData.INDEX_FIELD: 1, "rev": "working tree"},
+        {"0": "2", PlotData.INDEX_FIELD: 0, "rev": "workspace"},
+        {"0": "3", PlotData.INDEX_FIELD: 1, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == PlotData.INDEX_FIELD
     assert plot_content["encoding"]["y"]["field"] == "0"
@@ -86,14 +86,14 @@ def test_plot_csv_multiple_columns(tmp_dir, scm, dvc, run_copy_metrics):
         {
             "val": "2",
             PlotData.INDEX_FIELD: 0,
-            "rev": "working tree",
+            "rev": "workspace",
             "first_val": "100",
             "second_val": "100",
         },
         {
             "val": "3",
             PlotData.INDEX_FIELD: 1,
-            "rev": "working tree",
+            "rev": "workspace",
             "first_val": "200",
             "second_val": "300",
         },
@@ -119,13 +119,13 @@ def test_plot_csv_choose_axes(tmp_dir, scm, dvc, run_copy_metrics):
     assert plot_content["data"]["values"] == [
         {
             "val": "2",
-            "rev": "working tree",
+            "rev": "workspace",
             "first_val": "100",
             "second_val": "100",
         },
         {
             "val": "3",
-            "rev": "working tree",
+            "rev": "workspace",
             "first_val": "200",
             "second_val": "300",
         },
@@ -148,8 +148,8 @@ def test_plot_json_single_val(tmp_dir, scm, dvc, run_copy_metrics):
 
     plot_json = json.loads(plot_string)
     assert plot_json["data"]["values"] == [
-        {"val": 2, PlotData.INDEX_FIELD: 0, "rev": "working tree"},
-        {"val": 3, PlotData.INDEX_FIELD: 1, "rev": "working tree"},
+        {"val": 2, PlotData.INDEX_FIELD: 0, "rev": "workspace"},
+        {"val": 3, PlotData.INDEX_FIELD: 1, "rev": "workspace"},
     ]
     assert plot_json["encoding"]["x"]["field"] == PlotData.INDEX_FIELD
     assert plot_json["encoding"]["y"]["field"] == "val"
@@ -176,13 +176,13 @@ def test_plot_json_multiple_val(tmp_dir, scm, dvc, run_copy_metrics):
             "val": 2,
             PlotData.INDEX_FIELD: 0,
             "first_val": 100,
-            "rev": "working tree",
+            "rev": "workspace",
         },
         {
             "val": 3,
             PlotData.INDEX_FIELD: 1,
             "first_val": 200,
-            "rev": "working tree",
+            "rev": "workspace",
         },
     ]
     assert plot_content["encoding"]["x"]["field"] == PlotData.INDEX_FIELD
@@ -207,8 +207,8 @@ def test_plot_confusion(tmp_dir, dvc, run_copy_metrics):
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"predicted": "B", "actual": "A", "rev": "working tree"},
-        {"predicted": "A", "actual": "A", "rev": "working tree"},
+        {"predicted": "B", "actual": "A", "rev": "workspace"},
+        {"predicted": "A", "actual": "A", "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == "predicted"
     assert plot_content["encoding"]["y"]["field"] == "actual"
@@ -380,8 +380,8 @@ def test_custom_template(tmp_dir, scm, dvc, custom_template, run_copy_metrics):
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"a": 1, "b": 2, "rev": "working tree"},
-        {"a": 2, "b": 3, "rev": "working tree"},
+        {"a": 1, "b": 2, "rev": "workspace"},
+        {"a": 2, "b": 3, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == "a"
     assert plot_content["encoding"]["y"]["field"] == "b"
@@ -413,8 +413,8 @@ def test_custom_template_with_specified_data(
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"a": 1, "b": 2, "rev": "working tree"},
-        {"a": 2, "b": 3, "rev": "working tree"},
+        {"a": 1, "b": 2, "rev": "workspace"},
+        {"a": 2, "b": 3, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == "a"
     assert plot_content["encoding"]["y"]["field"] == "b"
@@ -450,8 +450,8 @@ def test_plot_override_specified_data_source(
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"a": 1, "b": 2, "rev": "working tree"},
-        {"a": 2, "b": 3, "rev": "working tree"},
+        {"a": 1, "b": 2, "rev": "workspace"},
+        {"a": 2, "b": 3, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == "a"
     assert plot_content["encoding"]["y"]["field"] == "b"
@@ -518,8 +518,8 @@ def test_plot_choose_columns(
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"b": 2, "c": 3, "rev": "working tree"},
-        {"b": 3, "c": 4, "rev": "working tree"},
+        {"b": 2, "c": 3, "rev": "workspace"},
+        {"b": 3, "c": 4, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == "b"
     assert plot_content["encoding"]["y"]["field"] == "c"
@@ -540,8 +540,8 @@ def test_plot_default_choose_column(tmp_dir, scm, dvc, run_copy_metrics):
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {PlotData.INDEX_FIELD: 0, "b": 2, "rev": "working tree"},
-        {PlotData.INDEX_FIELD: 1, "b": 3, "rev": "working tree"},
+        {PlotData.INDEX_FIELD: 0, "b": 2, "rev": "workspace"},
+        {PlotData.INDEX_FIELD: 1, "b": 3, "rev": "workspace"},
     ]
     assert plot_content["encoding"]["x"]["field"] == PlotData.INDEX_FIELD
     assert plot_content["encoding"]["y"]["field"] == "b"
@@ -560,8 +560,8 @@ def test_plot_yaml(tmp_dir, scm, dvc, run_copy_metrics):
 
     plot_content = json.loads(plot_string)
     assert plot_content["data"]["values"] == [
-        {"val": 2, PlotData.INDEX_FIELD: 0, "rev": "working tree"},
-        {"val": 3, PlotData.INDEX_FIELD: 1, "rev": "working tree"},
+        {"val": 2, PlotData.INDEX_FIELD: 0, "rev": "workspace"},
+        {"val": 3, PlotData.INDEX_FIELD: 1, "rev": "workspace"},
     ]
 
 
diff --git a/tests/unit/repo/plots/test_diff.py b/tests/unit/repo/plots/test_diff.py
--- a/tests/unit/repo/plots/test_diff.py
+++ b/tests/unit/repo/plots/test_diff.py
@@ -6,10 +6,10 @@
 @pytest.mark.parametrize(
     "arg_revisions,is_dirty,expected_revisions",
     [
-        ([], False, ["working tree"]),
-        ([], True, ["HEAD", "working tree"]),
-        (["v1", "v2", "working tree"], False, ["v1", "v2", "working tree"]),
-        (["v1", "v2", "working tree"], True, ["v1", "v2", "working tree"]),
+        ([], False, ["workspace"]),
+        ([], True, ["HEAD", "workspace"]),
+        (["v1", "v2", "workspace"], False, ["v1", "v2", "workspace"]),
+        (["v1", "v2", "workspace"], True, ["v1", "v2", "workspace"]),
     ],
 )
 def test_revisions(mocker, arg_revisions, is_dirty, expected_revisions):
diff --git a/tests/unit/repo/test_repo_tree.py b/tests/unit/repo/test_repo_tree.py
--- a/tests/unit/repo/test_repo_tree.py
+++ b/tests/unit/repo/test_repo_tree.py
@@ -38,7 +38,7 @@ def test_open_in_history(tmp_dir, scm, dvc):
     dvc.scm.commit("foofoo")
 
     for rev in dvc.brancher(revs=["HEAD~1"]):
-        if rev == "working tree":
+        if rev == "workspace":
             continue
 
         tree = RepoTree(dvc)
diff --git a/tests/unit/repo/test_tree.py b/tests/unit/repo/test_tree.py
--- a/tests/unit/repo/test_tree.py
+++ b/tests/unit/repo/test_tree.py
@@ -38,7 +38,7 @@ def test_open_in_history(tmp_dir, scm, dvc):
     dvc.scm.commit("foofoo")
 
     for rev in dvc.brancher(revs=["HEAD~1"]):
-        if rev == "working tree":
+        if rev == "workspace":
             continue
 
         tree = DvcTree(dvc)