Return HEAD when ref is refs/heads/main
R=ehmaldonado@chromium.org
Change-Id: I67b40cf48f0f9880e0f055a83d768bbefd704892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2528118
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md
index c2a5d54..c39ff4d 100644
--- a/recipes/README.recipes.md
+++ b/recipes/README.recipes.md
@@ -58,7 +58,7 @@
Wrapper for easy calling of bot_update.
-— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#524)(self, bot_update_step):**
+— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#525)(self, bot_update_step):**
Deapplies a patch, taking care of DEPS and solution revisions properly.
@@ -91,7 +91,7 @@
* enforce_fetch: Enforce a new fetch to refresh the git cache, even if the
solution revision passed in already exists in the current git cache.
-— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#501)(self, project_name, gclient_config=None):**
+— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#502)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of
a given project.
@@ -109,7 +109,7 @@
  **@property**<br>— **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#44)(self):**
-— **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#452)(self, bot_update_json, name):**
+— **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#453)(self, bot_update_json, name):**
Sets a fixed revision for a single dependency using project revision
properties.
diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py
index 86c95cd..d3d34a6 100644
--- a/recipes/recipe_modules/bot_update/api.py
+++ b/recipes/recipe_modules/bot_update/api.py
@@ -424,7 +424,7 @@
If there's no Gerrit CL associated with the run, returns 'HEAD'.
Otherwise this queries Gerrit for the correct destination ref, which
- might differ from refs/heads/master.
+ might differ from refs/heads/master or refs/heads/main.
Args:
* cfg: The used gclient config.
@@ -434,7 +434,8 @@
Returns:
A destination ref as understood by bot_update.py if available
- and if different from refs/heads/master, returns 'HEAD' otherwise.
+ and if different from refs/heads/master or refs/heads/main, returns
+ 'HEAD' otherwise.
"""
# Ignore project paths other than the one belonging to the current CL.
patch_path = self.m.gclient.get_gerrit_patch_root(gclient_config=cfg)
@@ -444,7 +445,7 @@
return 'HEAD'
target_ref = self.m.tryserver.gerrit_change_target_ref
- if target_ref in ['refs/heads/master', 'refs/heads/master']:
+ if target_ref in ['refs/heads/main', 'refs/heads/master']:
return 'HEAD'
return target_ref