[config_types.Path] Deprecate Path.is_parent_of()

Use 'x in Path.parents' instead, like with pathlib.Path.

Bug: 329113288
Change-Id: I2e299d840e75b2a366a454d02d6a3c51c6a68ef1
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/5468262
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Rob Mohr <mohrr@google.com>
Auto-Submit: Rob Mohr <mohrr@google.com>
diff --git a/recipe.warnings b/recipe.warnings
index 239fcab..c0287aa 100644
--- a/recipe.warnings
+++ b/recipe.warnings
@@ -114,6 +114,20 @@
 }
 
 warning {
+  name: "PATH_IS_PARENT_OF_DEPRECATED"
+  description: "config_types.Path.is_parent_of() is deprecated."
+  description: ""
+  description: "Use 'x in path.parents' instead."
+  description: ""
+  description: "This is part of a larger effort to replace config_types.Path"
+  description: "with pathlib.Path. Since the interfaces of the two classes are"
+  description: "not identical, config_types.Path is being made to look more"
+  description: "like pathlib.Path."
+  deadline: "2024-06-01"
+  google_issue { id: 329113288 }
+}
+
+warning {
   name: "PYTHON2_DEPRECATED"
   description: "Python2 is deprecated."
   description: ""
diff --git a/recipe_engine/config_types.py b/recipe_engine/config_types.py
index 2589b35..75639b6 100644
--- a/recipe_engine/config_types.py
+++ b/recipe_engine/config_types.py
@@ -368,6 +368,8 @@
 
   def is_parent_of(self, other: Path) -> bool:
     """True if |other| is in a subdirectory of this Path."""
+    from recipe_engine.internal.warn import record
+    record.GLOBAL.record_execution_warning('PATH_IS_PARENT_OF_DEPRECATED')
     spath = self
     opath = other
     # If they are BOTH CheckoutBasePath we can use them directly, otherwise we