Add upstream parameter when building an owners client.

code-owners plugins wants a git ref in Gerrit (e.g. refs/heads/master)
while Depot Tools wants a local git ref (e.g. refs/remotes/origin/main,
or a git hash).

Add an upstream parameters to be used by Depot Tools, separate from
a Gerrit ref expected by owners_client.

Change-Id: Ieed97a186e3140b3f82830efa189dbe3e4d8c806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2730049
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index be35fc7..a1515e8 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1509,13 +1509,15 @@
   @mock.patch('git_cl.Settings.GetBugPrefix')
   @mock.patch('git_cl.Changelist.FetchDescription')
   @mock.patch('git_cl.Changelist.GetBranch')
+  @mock.patch('git_cl.Changelist.GetCommonAncestorWithUpstream')
   @mock.patch('git_cl.Changelist.GetGerritHost')
   @mock.patch('git_cl.Changelist.GetGerritProject')
   @mock.patch('git_cl.Changelist.GetRemoteBranch')
   @mock.patch('owners_client.OwnersClient.BatchListOwners')
   def getDescriptionForUploadTest(
       self, mockBatchListOwners=None, mockGetRemoteBranch=None,
-      mockGetGerritProject=None, mockGetGerritHost=None, mockGetBranch=None,
+      mockGetGerritProject=None, mockGetGerritHost=None,
+      mockGetCommonAncestorWithUpstream=None, mockGetBranch=None,
       mockFetchDescription=None, mockGetBugPrefix=None,
       mockIsCodeOwnersEnabled=None,
       initial_description='desc', bug=None, fixed=None, branch='branch',
@@ -1531,6 +1533,7 @@
     mockIsCodeOwnersEnabled.return_value = True
     mockGetBranch.return_value = branch
     mockGetBugPrefix.return_value = 'prefix'
+    mockGetCommonAncestorWithUpstream.return_value = 'upstream'
     mockGetRemoteBranch.return_value = ('origin', 'refs/remotes/origin/main')
     mockFetchDescription.return_value = 'desc'
     mockBatchListOwners.side_effect = lambda ps: {