Fix bug 764323 - client.py needs to pass the revision argument to hgtool.py. r=Callek,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Wed, 09 Sep 2015 13:22:45 +0200
changeset 26349 d274c67702477c3ee5f7efd360aedf4cc7676f9d
parent 26348 4b4e76877e1f53c0dd42197280f6f6033b5015c0
child 26350 47628a8ce471f175d7fc389b28960d72d3fdb82b
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek, philipp
bugs764323
Fix bug 764323 - client.py needs to pass the revision argument to hgtool.py. r=Callek,a=philipp
client.py
--- a/client.py
+++ b/client.py
@@ -335,38 +335,54 @@ def do_hg_pull(dir, repository, hg, rev,
         if not os.path.exists(hgtool):
             hgtool = hgtool1
 
     if hgtool:
         hgtoolcmd = hgtool.split()
         # We need to strip the trailing slash from the repository url so that
         # the hg tool gets a url that's consistent with the rest of the build
         # automation.
+        repo = repository.rstrip('/')
+
+        # Make sure to unset the PROPERTIES_FILE variable, otherwise hgtool
+        # might use this for the revisions and branches.
+        hgtoolenv = os.environ.copy()
+        if 'PROPERTIES_FILE' in hgtoolenv:
+            del hgtoolenv['PROPERTIES_FILE']
+
+        # Set up the tool options, most importantly the revision
+        hgtoolopts = ['-r', rev]
+        if options.verbose:
+            hgtoolopts.append('-v')
+
         check_call_noisy(['python'] + hgtoolcmd +
-                         [repository.rstrip('/'), fulldir],
-                         retryMax=options.retries)
-    elif not os.path.exists(fulldir):
-        fulldir = os.path.join(topsrcdir, dir)
-        check_call_noisy([hg, 'clone'] + hgcloneopts + hgopts +
-                         [repository, fulldir],
+                         hgtoolopts +
+                         [repo, fulldir],
+                         env=hgtoolenv,
                          retryMax=options.retries)
     else:
-        cmd = [hg, 'pull', '-R', fulldir] + hgopts
-        if repository is not None:
-            cmd.append(repository)
-        check_call_noisy(cmd, retryMax=options.retries)
+        if not os.path.exists(fulldir):
+            fulldir = os.path.join(topsrcdir, dir)
+            check_call_noisy([hg, 'clone'] + hgcloneopts + hgopts +
+                             [repository, fulldir],
+                             retryMax=options.retries)
+        else:
+            cmd = [hg, 'pull', '-R', fulldir] + hgopts
+            if repository is not None:
+                cmd.append(repository)
+            check_call_noisy(cmd, retryMax=options.retries)
 
-    # update to specific revision
-    cmd = [hg, 'update', '-r', rev, '-R', fulldir] + hgopts
-    if options.verbose:
-        cmd.append('-v')
-    # Explicitly never retry 'hg update': otherwise any merge failures are
-    # ignored.
-    # This command is local: a failure can't be caused by a network error.
-    check_call_noisy(cmd, retryMax=0)
+        # update to specific revision
+        cmd = [hg, 'update', '-r', rev, '-R', fulldir] + hgopts
+        if options.verbose:
+            cmd.append('-v')
+        # Explicitly never retry 'hg update': otherwise any merge failures are
+        # ignored.
+        # This command is local: a failure can't be caused by a network error.
+        check_call_noisy(cmd, retryMax=0)
 
     check_call([hg, 'parent', '-R', fulldir,
                 '--template=Updated to revision {node}.\n'])
 
     if options.tinderbox_print and dir != '.':
         got_rev = check_call_output([hg, 'parent', '-R', fulldir,
                                      '--template={node|short}'])