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 22879 0ac48cae54bf
parent 22878 a0c43110aef7
child 22880 f23b301607b5
push id1462
push usermozilla@kewis.ch
push dateThu, 10 Sep 2015 21:36:12 +0000
treeherdercomm-beta@0ac48cae54bf [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}'])