Bug 1629115 - Properly use environment set from configuration for git-cinnabar. r=dhouse
authorMike Hommey <mh@glandium.org>
Thu, 16 Apr 2020 15:55:57 +0900
changeset 4489 187ceee0ce97ce7e1a7ee1dd68dfe58fa68f0584
parent 4488 904f897a1305a6a2dc02cfe754f006a7da37605d
child 4490 86d4c7fc2280c4d4350047ad46fb86f40960476f
push id3590
push usermh@glandium.org
push dateThu, 16 Apr 2020 21:42:48 +0000
reviewersdhouse
bugs1629115
Bug 1629115 - Properly use environment set from configuration for git-cinnabar. r=dhouse
scripts/vcs-sync/vcs_sync.py
--- a/scripts/vcs-sync/vcs_sync.py
+++ b/scripts/vcs-sync/vcs_sync.py
@@ -907,20 +907,21 @@ intree=1
                 repo_map['repos'][repo_name]['branches'][branch]['git_revision'] = git_revision
         self._write_repo_update_json(repo_map)
 
     def _update_cinnabar_mirror(self, repo_config, git, dest, generated_mapfile):
         # Do things somewhat equivalent to hg gexport with git-cinnabar, which involves:
         # - converting new hg changesets
         # - update tags
         # - update .hg/git-mapfile
+        env = self.query_env()
         partial_env = {
             'PATH': os.pathsep.join([
                 os.path.join(self.query_virtualenv_path(), 'bin'),
-                os.environ['PATH'],
+                env['PATH'],
             ]),
         }
         if self.retry(
             self.run_command,
             args=(git + [
                 '-c', 'gc.auto=0',
                 '-c', 'cinnabar.refs=bookmarks',
                 '-c', 'cinnabar.check=no-version-check',
@@ -1000,17 +1001,17 @@ intree=1
         # changeset ids.
         output = self.get_output_from_command(
             git + ['diff-tree', '-r', 'refs/cinnabar/map^4', 'refs/cinnabar/metadata^4'],
             cwd=dest,
         )
         git_sha1s = [diff_line.split()[-1].replace('/', '') for diff_line in (output or '').splitlines()]
         hg_sha1s = []
         CHUNK_SIZE = 50
-        env = os.environ.copy()
+        env = env.copy()
         env.update(partial_env)
         for offset in range(0, len(git_sha1s), CHUNK_SIZE):
             output = self.get_output_from_command(
                 git + ['-c', 'cinnabar.check=no-version-check', 'cinnabar', 'git2hg'] + git_sha1s[offset:offset + CHUNK_SIZE],
                 cwd=dest,
                 env=env,
             )
             hg_sha1s += (output or '').split()