Bug 1512882 - Fixup client.py for SeaMonkey 2.49.x release branch. r=IanN a=IanN DONTBUILD SEAMONKEY_2_49_ESR_RELBRANCH
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Mon, 15 Jul 2019 18:08:20 +0200
branchSEAMONKEY_2_49_ESR_RELBRANCH
changeset 28314 908f70442daa21da7c272ade9cec99204b235437
parent 28313 3fe8be0e3a645eb17b5e4ac6902677014102706d
child 28315 30f931e2beb44a76a61ef289d214a78ebeb85d95
push id2136
push userfrgrahl@gmx.net
push dateMon, 15 Jul 2019 16:13:42 +0000
treeherdercomm-esr52@6b30146aa411 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1512882
Bug 1512882 - Fixup client.py for SeaMonkey 2.49.x release branch. r=IanN a=IanN DONTBUILD SeaMonkey ESR52 release branch only.
client.py
--- a/client.py
+++ b/client.py
@@ -9,43 +9,51 @@
 
 # Repo Defaults
 # 'REV' controls the default rev for All the various repo's
 # Define x_REV to override. Where x can be one of:
 #  "COMM", "MOZILLA", "CHATZILLA", "INSPECTOR"
 DEFAULTS = {
     # Global Default Revision
     'REV': "default",
+    'COMM_BRANCH': "SEAMONKEY_2_49_ESR_RELBRANCH",
 
     # URL of the default hg repository to clone for ChatZilla.
     'CHATZILLA_REPO': 'https://hg.mozilla.org/chatzilla/',
     # The stable revision to use
-      'CHATZILLA_REV':  'SEA2_48_RELBRANCH',
+    # 'CHATZILLA_REV':  'default',
 
     # URL of the default hg repository to clone for DOM Inspector.
     'INSPECTOR_REPO': 'https://hg.mozilla.org/dom-inspector/',
     # The stable revision to use
-      'INSPECTOR_REV':  'DOMI_2_0_17',
+    # 'INSPECTOR_REV':  'default',
 
     # URL of the default hg repository to clone for Mozilla.
     'MOZILLA_REPO': 'https://hg.mozilla.org/releases/mozilla-esr52/',
+    'MOZILLA_BRANCH': "SEAMONKEY_2_49_ESR_RELBRANCH",
 }
 
 REPO_SHORT_NAMES = {
     'mozilla-central':  'moz',
     'dom-inspector':    'dom',
 }
 
 
 def get_DEFAULT_tag(index):
     if index in DEFAULTS:
         return DEFAULTS[index]
     else:
         return DEFAULTS['REV']
 
+def get_BRANCH_tag(index):
+    if index in DEFAULTS:
+        return DEFAULTS[index]
+    else:
+        return ''
+
 # The set of defaults below relate to the current switching mechanism between
 # trunk or branches and back again if it is required.
 
 # The current version expected in the .treestate file for nothing to happen.
 # This reflects the "[treestate] src_update_version = ..." value.
 #
 # src_update_version values:
 # '1' : mozilla/ may have been moved to mozilla-1.9.1 (or kept the same
@@ -312,17 +320,17 @@ def backup_cvs_extension(extensionName, 
     try:
         os.rename(extensionPath, extensionBackupPath)
     except:
         # Print the exception without its traceback.
         sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
         sys.exit("Error: %s directory renaming failed!" % extensionName)
 
 
-def do_hg_pull(dir, repository, hg, rev, hgtool=None, hgtool1=None):
+def do_hg_pull(dir, repository, hg, rev, branch, hgtool=None, hgtool1=None):
     """Clone if the dir doesn't exist, pull if it does.
     """
 
     fulldir = os.path.join(topsrcdir, dir)
 
     hgcloneopts = []
     if options.hgcloneopts:
         hgcloneopts = options.hgcloneopts.split()
@@ -366,17 +374,21 @@ def do_hg_pull(dir, repository, hg, rev,
                              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 rev != 'default':
+            cmd = [hg, 'update', '-r', rev, '-R', fulldir] + hgopts
+        else:
+            cmd = [hg, 'update', branch, '-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,
@@ -541,16 +553,17 @@ def fixup_comm_repo_options(options):
         else:
             print "Using COMM_REV from environment (%s)" % envRev
         options.comm_rev = envRev
 
     # If no version was set before, use the default comm revision.
     if options.comm_rev is None:
         options.comm_rev = get_DEFAULT_tag("COMM_REV")
 
+    options.comm_branch = get_BRANCH_tag("COMM_BRANCH")
 
 def fixup_mozilla_repo_options(options):
     """Handle special case: initial checkout of Mozilla.
 
     See fixup_comm_repo_options().
     """
     if options.mozilla_repo is None:
         if not os.path.exists(os.path.join(topsrcdir, 'mozilla')):
@@ -577,16 +590,17 @@ def fixup_mozilla_repo_options(options):
             print "Warning: Preferring MOZILLA_REV (%s) over passed revision (%s)" % (envRev, options.mozilla_rev)
         else:
             print "Using MOZILLA_REV from environment (%s)" % envRev
         options.mozilla_rev = envRev
 
     # If no version was set before, use the default mozilla revision.
     if options.mozilla_rev is None:
         options.mozilla_rev = get_DEFAULT_tag("MOZILLA_REV")
+    options.mozilla_branch = get_BRANCH_tag("MOZILLA_BRANCH")
 
 
 def fixup_chatzilla_repo_options(options):
     """Handle special case: initial hg checkout of Chatzilla.
 
     See fixup_comm_repo_options().
     backup_cvs_extension() is also called.
     """
@@ -596,16 +610,17 @@ def fixup_chatzilla_repo_options(options
     backup_cvs_extension('Chatzilla', 'irc', extensionPath)
 
     if options.chatzilla_repo is None and not os.path.exists(extensionPath):
         options.chatzilla_repo = DEFAULTS['CHATZILLA_REPO']
 
     if options.chatzilla_rev is None:
         options.chatzilla_rev = get_DEFAULT_tag("CHATZILLA_REV")
 
+    options.chatzilla_branch = get_BRANCH_tag("CHATZILLA_BRANCH")
 
 def fixup_inspector_repo_options(options):
     """Handle special case: initial checkout of DOM Inspector.
 
     See fixup_comm_repo_options().
     """
 
     # No cvs backup needed as DOM Inspector was part (and removed from)
@@ -613,16 +628,17 @@ def fixup_inspector_repo_options(options
     if options.inspector_repo is None and \
             not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions',
                                             'inspector')):
         options.inspector_repo = DEFAULTS['INSPECTOR_REPO']
 
     if options.inspector_rev is None:
         options.inspector_rev = get_DEFAULT_tag("INSPECTOR_REV")
 
+    options.inspector_branch = get_BRANCH_tag("CHATZILLA_BRANCH")
 
 def get_last_known_good_mozilla_rev():
     kg_url = "http://build.mozillamessaging.com/buildbot/production/known-good-revisions/mozilla-central.txt"
     try:
         rev = urllib2.urlopen(kg_url).read().strip()
     except IOError, err:
         sys.exit("Error: could not fetch '%s' (%s)" % (kg_url, err))
     if re.search(r'^[a-f0-9]+$', rev) and len(rev) == 12:
@@ -647,43 +663,47 @@ if options.default_rev:
             del DEFAULTS[index]
 
 if action in ('checkout', 'co'):
     # Update Comm repository configuration.
     repo_config()
 
     if not options.skip_comm:
         fixup_comm_repo_options(options)
-        do_hg_pull('.', options.comm_repo, options.hg, options.comm_rev)
+        do_hg_pull('.', options.comm_repo, options.hg, options.comm_rev,
+                   options.comm_branch)
 
     if not options.skip_mozilla:
         if options.known_good and options.mozilla_rev is None:
             print "Fetching last known good mozilla revision"
             options.mozilla_rev = get_last_known_good_mozilla_rev()
             print "Setting mozilla_rev to '%s'" % options.mozilla_rev
 
         fixup_mozilla_repo_options(options)
         do_hg_pull('mozilla', options.mozilla_repo, options.hg,
-                   options.mozilla_rev, options.hgtool, options.hgtool1)
+                   options.mozilla_rev, options.mozilla_branch, options.hgtool,
+                   options.hgtool1)
 
     # Check whether destination directory exists for these extensions.
     if (not options.skip_chatzilla or not options.skip_inspector) and \
        not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions')):
         # Don't create the directory: Mozilla repository should provide it...
         sys.exit("Error: mozilla/extensions directory does not exist;" +
                  " ChatZilla, and/or DOM Inspector cannot be checked out!")
 
     if not options.skip_chatzilla:
         fixup_chatzilla_repo_options(options)
         do_hg_pull(os.path.join('mozilla', 'extensions', 'irc'),
-                   options.chatzilla_repo, options.hg, options.chatzilla_rev)
+                   options.chatzilla_repo, options.hg, options.chatzilla_rev,
+                   options.chatzilla_branch)
 
     if not options.skip_inspector:
         fixup_inspector_repo_options(options)
         do_hg_pull(os.path.join('mozilla', 'extensions', 'inspector'),
-                   options.inspector_repo, options.hg, options.inspector_rev)
+                   options.inspector_repo, options.hg, options.inspector_rev,
+                   options.inspector_branch)
 
     if options.apply_patches:
         do_apply_patches(topsrcdir, options.hg)
 
 else:
     o.print_help()
     sys.exit(2)