Update .git/objects/info/alternates when upstream url changes.

BUG=497943
R=hinoka@chromium.org,agable@chromium.org

Review URL: https://codereview.chromium.org/1163403003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295568 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index cf19e35..9baa6f4 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -452,6 +452,11 @@
         self._CheckClean(rev_str)
       # Switch over to the new upstream
       self._Run(['remote', 'set-url', self.remote, url], options)
+      if mirror:
+        with open(os.path.join(
+            self.checkout_path, '.git', 'objects', 'info', 'alternates'),
+            'w') as fh:
+          fh.write(os.path.join(url, 'objects'))
       self._FetchAndReset(revision, file_list, options)
       return_early = True