Bug 1554987 - Invoke git push with a remote name for mach try. r=ahal
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 24 Jun 2019 21:36:31 +0000
changeset 542813 2f565c4f68f73e09a6ee863aba3ea2ac913f16c2
parent 542812 a5af8b04d7142774f69251a09a07444b81bf1ea0
child 542814 65f73e2c491b96b6bd2b4725b034487f622c0b7e
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1554987
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1554987 - Invoke git push with a remote name for mach try. r=ahal The git version shipped in some versions of OSX is patched by apple in a way such that doing `git push hg::ssh://...` fails with an error message like `Invalid remote name "hg::ssh://...`. So instead, we define a named remote via inline configuration, and use that remote's name for the push. Differential Revision: https://phabricator.services.mozilla.com/D35351
python/mozversioncontrol/mozversioncontrol/__init__.py
python/mozversioncontrol/test/test_push_to_try.py
--- a/python/mozversioncontrol/mozversioncontrol/__init__.py
+++ b/python/mozversioncontrol/mozversioncontrol/__init__.py
@@ -473,17 +473,21 @@ class GitRepository(Repository):
         return not len(self._run(*args).strip())
 
     def push_to_try(self, message):
         if not self.has_git_cinnabar:
             raise MissingVCSExtension('cinnabar')
 
         self._run('commit', '--allow-empty', '-m', message)
         try:
-            subprocess.check_call((self._tool, 'push', 'hg::ssh://hg.mozilla.org/try',
+            subprocess.check_call((self._tool,
+                                   '-c',
+                                   'remote.try.url=hg::ssh://hg.mozilla.org/try',
+                                   'push',
+                                   'try',
                                    '+HEAD:refs/heads/branches/default/tip'), cwd=self.path)
         finally:
             self._run('reset', 'HEAD~')
 
 
 def get_repository_object(path, hg='hg', git='git'):
     '''Get a repository object for the repository at `path`.
     If `path` is not a known VCS repository, raise an exception.
--- a/python/mozversioncontrol/test/test_push_to_try.py
+++ b/python/mozversioncontrol/test/test_push_to_try.py
@@ -34,18 +34,18 @@ def test_push_to_try(repo, monkeypatch):
         expected = [
             (tool, 'push-to-try', '-m', commit_message),
             (tool, 'revert', '-a'),
         ]
     else:
         expected = [
             (tool, 'cinnabar', '--version'),
             (tool, 'commit', '--allow-empty', '-m', commit_message),
-            (tool, 'push', 'hg::ssh://hg.mozilla.org/try',
-                   '+HEAD:refs/heads/branches/default/tip'),
+            (tool, '-c', 'remote.try.url=hg::ssh://hg.mozilla.org/try',
+                   'push', 'try', '+HEAD:refs/heads/branches/default/tip'),
             (tool, 'reset', 'HEAD~'),
         ]
 
     for i, value in enumerate(captured_commands):
         assert value == expected[i]
 
     assert len(captured_commands) == len(expected)