Bug 1292407 - Make artifact install call git with cwd equal to topsrcdir, r=nalexander draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 05 Aug 2016 14:41:34 +0800
changeset 397499 b4bba7d9781a847c16c9e24f2fc0cb971fea9c51
parent 396804 0ba72e8027cfcbcbf3426770ac264a7ade2af090
child 527481 522758873787d407f1c1a87d6aff41206a2c4f5f
push id25326
push userbmo:timdream@gmail.com
push dateSat, 06 Aug 2016 04:06:27 +0000
reviewersnalexander
bugs1292407
milestone51.0a1
Bug 1292407 - Make artifact install call git with cwd equal to topsrcdir, r=nalexander MozReview-Commit-ID: 9clWaG40qSL
python/mozbuild/mozbuild/artifacts.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -829,21 +829,21 @@ class Artifacts(object):
 
         return candidate_pushheads
 
     def _get_hg_revisions_from_git(self):
         rev_list = subprocess.check_output([
             self._git, 'rev-list', '--topo-order',
             '--max-count={num}'.format(num=NUM_REVISIONS_TO_QUERY),
             'HEAD',
-        ])
+        ], cwd=self._topsrcdir)
 
         hg_hash_list = subprocess.check_output([
             self._git, 'cinnabar', 'git2hg'
-        ] + rev_list.splitlines())
+        ] + rev_list.splitlines(), cwd=self._topsrcdir)
 
         zeroes = "0" * 40
 
         hashes = []
         for hg_hash in hg_hash_list.splitlines():
             hg_hash = hg_hash.strip()
             if not hg_hash or hg_hash == zeroes:
                 continue
@@ -997,22 +997,22 @@ class Artifacts(object):
 
     def install_from_recent(self, distdir):
         hg_pushheads = self._find_pushheads()
         return self._install_from_hg_pushheads(hg_pushheads, distdir)
 
     def install_from_revset(self, revset, distdir):
         if self._hg:
             revision = subprocess.check_output([self._hg, 'log', '--template', '{node}\n',
-                                                '-r', revset]).strip()
+                                                '-r', revset], cwd=self._topsrcdir).strip()
             if len(revision.split('\n')) != 1:
                 raise ValueError('hg revision specification must resolve to exactly one commit')
         else:
-            revision = subprocess.check_output([self._git, 'rev-parse', revset]).strip()
-            revision = subprocess.check_output([self._git, 'cinnabar', 'git2hg', revision]).strip()
+            revision = subprocess.check_output([self._git, 'rev-parse', revset], cwd=self._topsrcdir).strip()
+            revision = subprocess.check_output([self._git, 'cinnabar', 'git2hg', revision], cwd=self._topsrcdir).strip()
             if len(revision.split('\n')) != 1:
                 raise ValueError('hg revision specification must resolve to exactly one commit')
             if revision == "0" * 40:
                 raise ValueError('git revision specification must resolve to a commit known to hg')
 
         self.log(logging.INFO, 'artifact',
                  {'revset': revset,
                   'revision': revision},