Add `main` when guessing origin remote

This fixes presubmit checks that rely on FetchUpstreamTuple which is
used in patching.

R=ehmaldonado@chromium.org

Bug: 1143724
Change-Id: I163fa0ea6f1b356280d497196869bb206463ad4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2515268
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/scm.py b/scm.py
index 662ab7e..c374a66 100644
--- a/scm.py
+++ b/scm.py
@@ -226,7 +226,11 @@
       return remote, upstream_branch
 
     # Else, try to guess the origin remote.
-    if 'origin/master' in GIT.GetRemoteBranches(cwd):
+    remote_branches = GIT.GetRemoteBranches(cwd)
+    if 'origin/main' in remote_branches:
+      # Fall back on origin/main if it exits.
+      return 'origin', 'refs/heads/main'
+    elif 'origin/master' in remote_branches:
       # Fall back on origin/master if it exits.
       return 'origin', 'refs/heads/master'