[poky] [PATCH 4/8] hg.py: move hg specific url data initialization earlier

Yu Ke ke.yu at intel.com
Mon Dec 27 05:57:28 PST 2010


move the url data init earlier, so that Hg.latest_revision()
can work before Hg.localpath()

This change allow FetchData:__init__ to set FetchData.revison by
calling Hg.latest_revision()

Signed-off-by: Yu Ke <ke.yu at intel.com>
---
 bitbake/lib/bb/fetch/hg.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index 6dd75cb..85d640d 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -39,9 +39,17 @@ class Hg(Fetch):
         """
         Check to see if a given url can be fetched with mercurial.
         """
-        return ud.type in ['hg']
+        if ud.type in ['hg']:
+            self.urldata_init(ud, d)
+            return True
+        else:
+            return False
 
-    def localpath(self, url, ud, d):
+    def urldata_init(self, ud, d):
+        """
+        init hg specific variable within url data
+        so that the hg method like latest_revision() can work
+        """
         if not "module" in ud.parm:
             raise MissingParameterError("hg method needs a 'module' parameter")
 
@@ -55,6 +63,7 @@ class Hg(Fetch):
         ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath)
         ud.moddir = os.path.join(ud.pkgdir, ud.module)
 
+    def localpath(self, url, ud, d):
         if 'rev' in ud.parm:
             ud.revision = ud.parm['rev']
         else:
-- 
1.7.0.4




More information about the poky mailing list