Use main branch as the default branch

R=apolito@google.com

Change-Id: I6a2ed557b9e8d45194b2fe4ea5327ce62020733c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3000134
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
index 6fa3bd5..fbb15c3 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -112,8 +112,8 @@
 data 4
 Bye
 
-reset refs/heads/master
-commit refs/heads/master
+reset refs/heads/main
+commit refs/heads/main
 mark :3
 author Bob <bob@example.com> 1253744361 -0700
 committer Bob <bob@example.com> 1253744361 -0700
@@ -158,7 +158,7 @@
 from :3
 M 100644 :7 c
 
-reset refs/heads/master
+reset refs/heads/main
 from :3
 """
   def Options(self, *args, **kwargs):
@@ -186,9 +186,9 @@
         cwd=path).communicate()
     Popen([GIT, 'remote', 'add', '-f', 'origin', '.'], stdout=PIPE,
         stderr=STDOUT, cwd=path).communicate()
-    Popen([GIT, 'checkout', '-b', 'new', 'origin/master', '-q'], stdout=PIPE,
+    Popen([GIT, 'checkout', '-b', 'new', 'origin/main', '-q'], stdout=PIPE,
         stderr=STDOUT, cwd=path).communicate()
-    Popen([GIT, 'push', 'origin', 'origin/origin:origin/master', '-q'],
+    Popen([GIT, 'push', 'origin', 'origin/origin:origin/main', '-q'],
         stdout=PIPE, stderr=STDOUT, cwd=path).communicate()
     Popen([GIT, 'config', '--unset', 'remote.origin.fetch'], stdout=PIPE,
         stderr=STDOUT, cwd=path).communicate()
@@ -196,8 +196,8 @@
         stderr=STDOUT, cwd=path).communicate()
     Popen([GIT, 'config', 'user.name', 'Some User'], stdout=PIPE,
         stderr=STDOUT, cwd=path).communicate()
-    # Set HEAD back to master
-    Popen([GIT, 'checkout', 'master', '-q'],
+    # Set HEAD back to main
+    Popen([GIT, 'checkout', 'main', '-q'],
           stdout=PIPE,
           stderr=STDOUT,
           cwd=path).communicate()
@@ -393,7 +393,7 @@
     parent = 'HEAD^' if sys.platform != 'win32' else 'HEAD^^'
     self.assertEqual(scm._Capture(['rev-parse', parent + '1']), rev)
     self.assertEqual(scm._Capture(['rev-parse', parent + '2']),
-                     scm._Capture(['rev-parse', 'origin/master']))
+                     scm._Capture(['rev-parse', 'origin/main']))
     sys.stdout.close()
 
   def testUpdateRebase(self):
@@ -417,7 +417,7 @@
                      'd2e35c10ac24d6c621e14a1fcadceb533155627d')
     parent = 'HEAD^' if sys.platform != 'win32' else 'HEAD^^'
     self.assertEqual(scm._Capture(['rev-parse', parent + '1']),
-                     scm._Capture(['rev-parse', 'origin/master']))
+                     scm._Capture(['rev-parse', 'origin/main']))
     sys.stdout.close()
 
   def testUpdateReset(self):
@@ -561,7 +561,7 @@
       scm.update(options, (), [])
     self.assertEqual(
         e.exception.args[0],
-        '\n____ . at refs/remotes/origin/master\n'
+        '\n____ . at refs/remotes/origin/main\n'
         '\tYou have unstaged changes.\n'
         '\tPlease commit, stash, or reset.\n')
 
@@ -758,7 +758,7 @@
     # indicates detached HEAD
     self.assertEqual(self.getCurrentBranch(), None)
     self.checkInStdout(
-      'Checked out refs/remotes/origin/master to a detached HEAD')
+      'Checked out refs/remotes/origin/main to a detached HEAD')
 
 
   def testUpdateCloneOnCommit(self):
@@ -1000,11 +1000,11 @@
     #    |
     #    4
     #    |
-    # 1--2--3 refs/heads/master
+    # 1--2--3 refs/heads/main
     self._commit_git('repo_1', {'commit 1': 'touched'})
     self._commit_git('repo_1', {'commit 2': 'touched'})
     self._commit_git('repo_1', {'commit 3': 'touched'})
-    self._create_ref('repo_1', 'refs/heads/master', 3)
+    self._create_ref('repo_1', 'refs/heads/main', 3)
 
     self._commit_git('repo_1', {'commit 4': 'touched'}, base=2)
     self._commit_git('repo_1', {'commit 5': 'touched'}, base=2)
@@ -1073,9 +1073,9 @@
     #       |
     #       5 refs/changes/34/1234/1
     #       |
-    # 1--2--3--4 refs/heads/master
+    # 1--2--3--4 refs/heads/main
     #    |  |
-    #    |  11(5)--12 refs/heads/master-with-5
+    #    |  11(5)--12 refs/heads/main-with-5
     #    |
     #    7--8--9 refs/heads/feature
     #       |
@@ -1086,7 +1086,7 @@
     self._commit_git('repo_1', {'commit 2': 'touched'})
     self._commit_git('repo_1', {'commit 3': 'touched'})
     self._commit_git('repo_1', {'commit 4': 'touched'})
-    self._create_ref('repo_1', 'refs/heads/master', 4)
+    self._create_ref('repo_1', 'refs/heads/main', 4)
 
     # Create a change on top of commit 3 that consists of two commits.
     self._commit_git('repo_1',
@@ -1113,7 +1113,7 @@
                      base=8)
     self._create_ref('repo_1', 'refs/changes/36/1236/1', 10)
 
-    # Create a refs/heads/master-with-5 on top of commit 3 which is a branch
+    # Create a refs/heads/main-with-5 on top of commit 3 which is a branch
     # where refs/changes/34/1234/1 (commit 5) has already landed as commit 11.
     self._commit_git('repo_1',
                      # This is really commit 11, but has the changes of commit 5
@@ -1121,7 +1121,7 @@
                       'change': '1234'},
                      base=3)
     self._commit_git('repo_1', {'commit 12': 'touched'})
-    self._create_ref('repo_1', 'refs/heads/master-with-5', 12)
+    self._create_ref('repo_1', 'refs/heads/main-with-5', 12)
 
 
 class GerritChangesTest(fake_repos.FakeReposTestBase):
@@ -1202,7 +1202,7 @@
     self.assertEqual(push_url, self.url)
 
   def testAppliesPatchOnTopOfMasterByDefault(self):
-    """Test the default case, where we apply a patch on top of master."""
+    """Test the default case, where we apply a patch on top of main."""
     scm = gclient_scm.GitWrapper(self.url, self.root_dir, '.')
     file_list = []
 
@@ -1212,7 +1212,7 @@
     self.assertEqual(self.githash('repo_1', 4), self.gitrevparse(self.root_dir))
 
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     self.assertCommits([1, 2, 3, 4, 5, 6])
@@ -1235,14 +1235,14 @@
 
     # Apply the change on top of that.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     self.assertCommits([1, 5, 6])
     self.assertEqual(self.githash('repo_1', 1), self.gitrevparse(self.root_dir))
 
   def testCheckoutOriginFeature(self):
-    """Tests that we can apply a patch on a branch other than master."""
+    """Tests that we can apply a patch on a branch other than main."""
     scm = gclient_scm.GitWrapper(self.url, self.root_dir, '.')
     file_list = []
 
@@ -1261,7 +1261,7 @@
 
   def testCheckoutOriginFeatureOnOldRevision(self):
     """Tests that we can apply a patch on an old checkout, on a branch other
-    than master."""
+    than main."""
     scm = gclient_scm.GitWrapper(self.url, self.root_dir, '.')
     file_list = []
 
@@ -1276,7 +1276,7 @@
         file_list)
 
     # We shouldn't have rebased on top of 2 (which is the merge base between
-    # remote's master branch and the change) but on top of 7 (which is the
+    # remote's main branch and the change) but on top of 7 (which is the
     # merge base between remote's feature branch and the change).
     self.assertCommits([1, 2, 7, 10])
     self.assertEqual(self.githash('repo_1', 7), self.gitrevparse(self.root_dir))
@@ -1290,10 +1290,10 @@
     scm.update(self.options, None, file_list)
     self.assertEqual(self.githash('repo_1', 9), self.gitrevparse(self.root_dir))
 
-    # Apply refs/changes/34/1234/1, created for remote's master branch on top of
+    # Apply refs/changes/34/1234/1, created for remote's main branch on top of
     # remote's feature branch.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     # Commits 5 and 6 are part of the patch, and commits 1, 2, 7, 8 and 9 are
@@ -1313,7 +1313,7 @@
 
     # Apply the change on top of that.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     self.assertCommits([1, 2, 3, 5, 6])
@@ -1333,7 +1333,7 @@
 
     # Apply the change on top of that.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     self.assertCommits([1, 2, 3, 5, 6])
@@ -1349,7 +1349,7 @@
     self.assertEqual(self.githash('repo_1', 4), self.gitrevparse(self.root_dir))
 
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
 
     self.assertCommits([1, 2, 3, 4, 5, 6])
@@ -1370,7 +1370,7 @@
     # patch 'refs/changes/36/1236/1' creates a patch failure.
     with self.assertRaises(subprocess2.CalledProcessError) as cm:
       scm.apply_patch_ref(
-          self.url, 'refs/changes/36/1236/1', 'refs/heads/master', self.options,
+          self.url, 'refs/changes/36/1236/1', 'refs/heads/main', self.options,
           file_list)
     self.assertEqual(cm.exception.cmd[:2], ['git', 'cherry-pick'])
     self.assertIn(b'error: could not apply', cm.exception.stderr)
@@ -1378,7 +1378,7 @@
     # Try to apply 'refs/changes/35/1235/1', which doesn't have a merge
     # conflict.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
     self.assertCommits([1, 2, 3, 5, 6])
     self.assertEqual(self.githash('repo_1', 5), self.gitrevparse(self.root_dir))
@@ -1387,7 +1387,7 @@
     scm = gclient_scm.GitWrapper(self.url, self.root_dir, '.')
     file_list = []
 
-    self.options.revision = 'refs/heads/master-with-5'
+    self.options.revision = 'refs/heads/main-with-5'
     scm.update(self.options, None, file_list)
     self.assertEqual(self.githash('repo_1', 12),
                      self.gitrevparse(self.root_dir))
@@ -1421,7 +1421,7 @@
     # Try to apply 'refs/changes/35/1235/1', which doesn't have a merge
     # conflict.
     scm.apply_patch_ref(
-        self.url, 'refs/changes/35/1235/1', 'refs/heads/master', self.options,
+        self.url, 'refs/changes/35/1235/1', 'refs/heads/main', self.options,
         file_list)
     self.assertCommits([1, 2, 3, 5, 6])
     self.assertEqual(self.githash('repo_1', 5), self.gitrevparse(self.root_dir))