Restore include support.

Calculation of where the include file lives was broken by 23acdd3f14
since it resulted in looking for the first include in .repo, rather
than .repo/manifests.

While people can work around it via setting their includes to
manifests/<include-target>, that breaks down since each layer of
includes would then have to be relative.

As such, restore the behaviour back to 2644874d; manifests includes
are calculated relative to the manifest root (ie, .repo/manifests);
local manifests includes are calculated relative to .repo/ .

Change-Id: I74c19ba614c41d2f08cd3e9fd094f3c510e3bfd1
diff --git a/manifest_xml.py b/manifest_xml.py
index daf5740..a46cf24 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -283,11 +283,12 @@
       self.branch = b
 
       nodes = []
-      nodes.append(self._ParseManifestXml(self.manifestFile))
+      nodes.append(self._ParseManifestXml(self.manifestFile,
+                                          self.manifestProject.worktree))
 
       local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
       if os.path.exists(local):
-        nodes.append(self._ParseManifestXml(local))
+        nodes.append(self._ParseManifestXml(local, self.repodir))
 
       self._ParseManifest(nodes)
 
@@ -297,7 +298,7 @@
 
       self._loaded = True
 
-  def _ParseManifestXml(self, path):
+  def _ParseManifestXml(self, path, include_root):
     root = xml.dom.minidom.parse(path)
     if not root or not root.childNodes:
       raise ManifestParseError("no root node in %s" % (path,))
@@ -310,13 +311,13 @@
     for node in config.childNodes:
         if node.nodeName == 'include':
             name = self._reqatt(node, 'name')
-            fp = os.path.join(os.path.dirname(path), name)
+            fp = os.path.join(include_root, name)
             if not os.path.isfile(fp):
                 raise ManifestParseError, \
                     "include %s doesn't exist or isn't a file" % \
                     (name,)
             try:
-                nodes.extend(self._ParseManifestXml(fp))
+                nodes.extend(self._ParseManifestXml(fp, include_root))
             # should isolate this to the exact exception, but that's
             # tricky.  actual parsing implementation may vary.
             except (KeyboardInterrupt, RuntimeError, SystemExit):