gclient: set the push url to the actual repository instead of the mirror.

Bug: 884434
Change-Id: Id156709e14d1c3506a1236bc1e59f8468381a402
Reviewed-on: https://chromium-review.googlesource.com/1232257
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/gclient_scm.py b/gclient_scm.py
index a4c0dfd..70ec6a9 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -550,14 +550,21 @@
         self._Clone(revision, url, options)
       if file_list is not None:
         files = self._Capture(
-          ['-c', 'core.quotePath=false', 'ls-files']).splitlines()
+            ['-c', 'core.quotePath=false', 'ls-files']).splitlines()
         file_list.extend([os.path.join(self.checkout_path, f) for f in files])
+      if mirror:
+        self._Capture(
+            ['remote', 'set-url', '--push', 'origin', mirror.url])
       if not verbose:
         # Make the output a little prettier. It's nice to have some whitespace
         # between projects when cloning.
         self.Print('')
       return self._Capture(['rev-parse', '--verify', 'HEAD'])
 
+    if mirror:
+      self._Capture(
+          ['remote', 'set-url', '--push', 'origin', mirror.url])
+
     if not managed:
       self._SetFetchConfig(options)
       self.Print('________ unmanaged solution; skipping %s' % self.relpath)