firefoxtree: don't track try repos (bug 1237339); r?dminor draft
authorGregory Szorc <gps@mozilla.com>
Wed, 06 Jan 2016 10:48:21 -0800
changeset 6624 0d9f88a3f1319ccec845edf08c0b9a81a68306d2
parent 6623 de4852e08d137ebc2a908e993e774a0267ac20c2
push id497
push usergszorc@mozilla.com
push dateWed, 06 Jan 2016 18:48:14 +0000
reviewersdminor
bugs1237339
firefoxtree: don't track try repos (bug 1237339); r?dminor It doesn't make sense to track remote refs for try repos. Filter try repos from the repos list when reading and writing the file and when updating remote refs.
hgext/firefoxtree/__init__.py
hgext/firefoxtree/tests/test-tree-tags.t
pylib/mozautomation/mozautomation/repository.py
--- a/hgext/firefoxtree/__init__.py
+++ b/hgext/firefoxtree/__init__.py
@@ -90,16 +90,17 @@ from mercurial.node import (
 
 OUR_DIR = os.path.dirname(__file__)
 execfile(os.path.join(OUR_DIR, '..', 'bootstrap.py'))
 
 from mozautomation.repository import (
     MULTI_TREE_ALIASES,
     resolve_trees_to_uris,
     resolve_uri_to_tree,
+    TRY_TREES,
 )
 
 testedwith = '3.3 3.4 3.5 3.6'
 buglink = 'https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Services&component=Mercurial%3A%20firefoxtree'
 # The root revisions in mozilla-central and comm-central, respectively.
 MOZ_ROOT_REV = '8ba995b74e18334ab3707f27e9eb8f4e37ba3d29'
 COMM_ROOT_REV = 'e4f4569d451a5e0d12a6aa33ebd916f979dd8faa'
 
@@ -221,26 +222,35 @@ def readfirefoxtrees(repo):
         return trees
 
     for line in data.splitlines():
         line = line.strip()
         if not line:
             continue
 
         tree, hexnode = line.split()
+
+        # Filter out try repos because they are special.
+        if tree in TRY_TREES:
+            continue
+
         trees[tree] = bin(hexnode)
 
     return trees
 
 
 def writefirefoxtrees(repo):
     """Write the firefoxtrees node mapping to the filesystem."""
     lines = []
     trees = {}
     for tree, node in sorted(repo.firefoxtrees.items()):
+        # Filter out try repos because they are special.
+        if tree in TRY_TREES:
+            continue
+
         assert len(node) == 20
         lines.append('%s %s' % (tree, hex(node)))
         trees[tree] = hex(node)
 
     _firefoxtreesrepo(repo).vfs.write('firefoxtrees', '\n'.join(lines))
 
     # Old versions of firefoxtrees stored labels in the localtags file. Since
     # this file is read by Mercurial and has no relevance to us any more, we
@@ -380,16 +390,20 @@ def updateremoterefs(repo, remote, tree)
     Firefox repos.
     """
     # TODO Somehow the custom repo class is lost and the firefoxtrees attribute
     # isn't accessible. This is possibly a result of repo filter and/or clone
     # bundles interaction. See bug 1234396.
     if getattr(repo, 'firefoxtrees', None) is None:
         return
 
+    # Ignore try repos because they are special.
+    if tree in TRY_TREES:
+        return
+
     # We only care about the default branch. We could import
     # RELBRANCH and other branches if we really cared about it.
     # Maybe later.
     branchmap = remote.branchmap()
     if 'default' not in branchmap:
         return
 
     # Firefox repos should only ever have a single head in the
--- a/hgext/firefoxtree/tests/test-tree-tags.t
+++ b/hgext/firefoxtree/tests/test-tree-tags.t
@@ -93,8 +93,31 @@ hg fxheads revset gives known tree commi
 {fxheads} with multiple values
 
   $ hg -q pull b2ginbound
   $ hg log -T '{rev} {join(fxheads, " ")}\n'
   3 inbound
   2 
   1 b2ginbound central
   0 
+
+"try" is filtered from firefoxtrees
+
+  $ cat >> .hg/firefoxtrees << EOF
+  > 
+  > try 994ec05999daf04fb3c01a8cb0dea1458a7d4d3d
+  > EOF
+
+  $ hg pull fxtrees
+  pulling from b2ginbound
+  searching for changes
+  no changes found
+  pulling from central
+  searching for changes
+  no changes found
+  pulling from inbound
+  searching for changes
+  no changes found
+
+  $ cat .hg/firefoxtrees
+  b2ginbound 994ec05999daf04fb3c01a8cb0dea1458a7d4d3d
+  central 994ec05999daf04fb3c01a8cb0dea1458a7d4d3d
+  inbound 1b348279b0e9b3c29568b6abc8a1776a68d39261 (no-eol)
--- a/pylib/mozautomation/mozautomation/repository.py
+++ b/pylib/mozautomation/mozautomation/repository.py
@@ -157,16 +157,21 @@ RELEASE_TREES = set([
     'b2g32',
     'b2g34',
     'b2g37',
     'b2g44',
     'b2g-ota',
 ])
 
 
+TRY_TREES = set([
+    'try',
+    'try-comm',
+])
+
 def resolve_trees_to_official(trees):
     mapped = []
     for tree in trees:
         mapped.extend(TREE_ALIASES.get(tree, [tree]))
     mapped = [OFFICIAL_MAP.get(tree, tree) for tree in mapped]
 
     return mapped