Py3 fixes for VCS syncing (#27706)

These changes address various errors that are currently preventing Servo's nightly downstream sync of WPT from completing.
diff --git a/tools/wptrunner/wptrunner/update/sync.py b/tools/wptrunner/wptrunner/update/sync.py
index f878752..4ace28f 100644
--- a/tools/wptrunner/wptrunner/update/sync.py
+++ b/tools/wptrunner/wptrunner/update/sync.py
@@ -67,7 +67,7 @@
                          state.local_branch)
         sync_path = os.path.abspath(sync_tree.root)
         if sync_path not in sys.path:
-            from update import setup_paths
+            from .update import setup_paths
             setup_paths(sync_path)
 
     def restore(self, state):
diff --git a/tools/wptrunner/wptrunner/update/tree.py b/tools/wptrunner/wptrunner/update/tree.py
index 34c709d..2f43bac 100644
--- a/tools/wptrunner/wptrunner/update/tree.py
+++ b/tools/wptrunner/wptrunner/update/tree.py
@@ -85,7 +85,7 @@
 
     @property
     def is_clean(self):
-        return self.hg("status").strip() == ""
+        return self.hg("status").strip() == b""
 
     def add_new(self, prefix=None):
         if prefix is not None:
@@ -103,7 +103,7 @@
         except subprocess.CalledProcessError:
             pass
 
-        patch_names = [item.strip() for item in self.hg("qseries").split("\n") if item.strip()]
+        patch_names = [item.strip() for item in self.hg("qseries").split(b"\n") if item.strip()]
 
         suffix = 0
         test_name = patch_name
@@ -140,7 +140,7 @@
 
     def __init__(self, root=None, log_error=True):
         if root is None:
-            root = git("rev-parse", "--show-toplevel", log_error=log_error).strip()
+            root = git("rev-parse", "--show-toplevel", log_error=log_error).strip().decode('utf-8')
         self.root = root
         self.git = vcs.bind_to_repo(git, self.root, log_error=log_error)
         self.message = None
@@ -176,7 +176,7 @@
 
     @property
     def is_clean(self):
-        return self.git("status").strip() == ""
+        return self.git("status").strip() == b""
 
     def add_new(self, prefix=None):
         """Add files to the staging area.
@@ -201,7 +201,7 @@
             f.seek(0)
             ignored_files = sync_tree.git("check-ignore", "--no-index", "--stdin", "-z", stdin=f)
         args = []
-        for entry in ignored_files.split('\0'):
+        for entry in ignored_files.decode('utf-8').split('\0'):
             args.append(os.path.join(prefix, entry))
         if args:
             self.git("add", "--force", *args)
@@ -217,7 +217,7 @@
             args.append(ref_filter)
         data = self.git("show-ref", *args)
         rv = []
-        for line in data.split("\n"):
+        for line in data.split(b"\n"):
             if not line.strip():
                 continue
             sha1, ref = line.split()
@@ -235,7 +235,7 @@
             args.append(ref_filter)
         data = self.git("ls-remote", remote, *args)
         rv = []
-        for line in data.split("\n"):
+        for line in data.split(b"\n"):
             if not line.strip():
                 continue
             sha1, ref = line.split()
@@ -248,8 +248,8 @@
         :param remote: the remote URL
         :param branch: the branch name"""
         for sha1, ref in self.list_remote(remote, branch):
-            if ref == "refs/heads/%s" % branch:
-                return self.commit_cls(self, sha1)
+            if ref.decode('utf-8') == "refs/heads/%s" % branch:
+                return self.commit_cls(self, sha1.decode('utf-8'))
         assert False
 
     def create_patch(self, patch_name, message):
@@ -297,8 +297,8 @@
 
         args = []
         if branch:
-            branches = [ref[len("refs/heads/"):] for sha1, ref in self.list_refs()
-                        if ref.startswith("refs/heads/")]
+            branches = [ref[len("refs/heads/"):].decode('utf-8') for sha1, ref in self.list_refs()
+                        if ref.startswith(b"refs/heads/")]
             branch = get_unique_name(branches, branch)
 
             args += ["-b", branch]
@@ -334,8 +334,8 @@
         rv = []
 
         for repo_path in repo_paths:
-            paths = vcs.git("ls-tree", "-r", "--name-only", "HEAD", repo=repo_path).split("\n")
-            rv.extend(os.path.relpath(os.path.join(repo_path, item), self.root) for item in paths
+            paths = vcs.git("ls-tree", "-r", "--name-only", "HEAD", repo=repo_path).split(b"\n")
+            rv.extend(os.path.relpath(os.path.join(repo_path, item.decode('utf-8')), self.root) for item in paths
                       if item.strip())
         return rv
 
@@ -343,11 +343,11 @@
         """List submodule directories"""
         output = self.git("submodule", "status", "--recursive")
         rv = []
-        for line in output.split("\n"):
+        for line in output.split(b"\n"):
             line = line.strip()
             if not line:
                 continue
-            parts = line.split(" ")
+            parts = line.split(b" ")
             rv.append(parts[1])
         return rv
 
@@ -401,5 +401,5 @@
         self.git = self.tree.git
 
     def _get_meta(self):
-        author, email, message = self.git("show", "-s", "--format=format:%an\n%ae\n%B", self.sha1).split("\n", 2)
+        author, email, message = self.git("show", "-s", "--format=format:%an\n%ae\n%B", self.sha1).decode('utf-8').split("\n", 2)
         return author, email, self.msg_cls(message)