Bug 1292561 - Use robustcheckout from the wizard on interactive loaners, r?gps draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Sun, 04 Sep 2016 10:33:22 -0400
changeset 411745 beed5bf9b354af8dd2b409a21592c45a50f8e490
parent 411657 938ce16be25f9c551c19ef8938e8717ed3d41ff5
child 530807 bccd78143d9c982b2f1baf1cbd18cf57f134d6ec
push id28976
push userahalberstadt@mozilla.com
push dateThu, 08 Sep 2016 16:54:41 +0000
reviewersgps
bugs1292561
milestone51.0a1
Bug 1292561 - Use robustcheckout from the wizard on interactive loaners, r?gps Robust checkout is the preferred method to clone a mercurial repository. This should speed up the cloning process a bit and reduce storage size. MozReview-Commit-ID: 92rcwMwRLYN
taskcluster/scripts/tester/run-wizard
--- a/taskcluster/scripts/tester/run-wizard
+++ b/taskcluster/scripts/tester/run-wizard
@@ -72,30 +72,42 @@ Mozharness has finished downloading the 
 A limited mach environment has also been set up and added to the $PATH, but
 it may be missing the command you need. To see a list of commands, run:
     $ mach help
 """.lstrip().format(build_dir))
 
 
 def clone():
     """Clone the correct gecko repository and update to the proper revision."""
-    repo = os.environ['GECKO_HEAD_REPOSITORY']
-    rev = os.environ['GECKO_HEAD_REV']
-    clone_path = os.path.expanduser(os.path.join('~', 'gecko'))
+    base_repo = os.environ['GECKO_HEAD_REPOSITORY']
+    dest = os.path.expanduser(os.path.join('~', 'gecko'))
 
-    # try is too large to clone, instead clone central and pull
-    # in changes from try
-    if "hg.mozilla.org/try" in repo:
-        central = 'http://hg.mozilla.org/mozilla-central'
-        call(['hg', 'clone', '-U', central, clone_path])
-        call(['hg', 'pull', '-u', '-r', rev, repo], cwd=clone_path)
+    # Specify method to checkout a revision. This defaults to revisions as
+    # SHA-1 strings, but also supports symbolic revisions like `tip` via the
+    # branch flag.
+    if os.environ.get('GECKO_HEAD_REV'):
+        revision_flag = b'--revision'
+        revision = os.environ['GECKO_HEAD_REV']
+    elif os.environ.get('GECKO_HEAD_REF'):
+        revision_flag = b'--branch'
+        revision = os.environ['GECKO_HEAD_REF']
     else:
-        call(['hg', 'clone', '-u', rev, repo, clone_path])
-    print("Finished cloning to {} at revision {}.".format(
-                clone_path, rev))
+        print('revision is not specified for checkout')
+        return 1
+
+    # TODO Bug 1301382 - pin hg.mozilla.org fingerprint.
+    call([
+        b'/usr/bin/hg', b'robustcheckout',
+        b'--sharebase', b'/home/worker/hg-shared',
+        b'--purge',
+        b'--upstream', b'https://hg.mozilla.org/mozilla-unified',
+        revision_flag, revision,
+        base_repo, dest
+    ])
+    print("Finished cloning to {} at revision {}.".format(dest, revision))
 
 
 def exit():
     pass
 
 
 OPTIONS = [
     ('Resume task', resume,