Allow mercurial fetcher to follow tip
There are occasions when developing when I want a package always to grab the latest copy of a package. Witht eh CVS fetcher you can do this by setting the date' tag to now'. This patch adds similar functionality to the mercurial fetcher: if the revision to fetch is `tip' then always grab from the server, and don't use the cached tarball.
Oh, and I fixed a typo in the Class comment.
Signed-off-by Peter Chubb <[email protected]>
lib/bb/fetch/hg.py renamed from lib/bb/fetch/hg.py~ +10 -2
@@ -34,13 +34,21 @@ from bb.fetch import runfetchcmd class Hg(Fetch): - """Class to fetch a from mercurial repositories""" + """Class to fetch from mercurial repositories""" def supports(self, url, ud, d): """ Check to see if a given url can be fetched with mercurial. """ return ud.type in ['hg'] + def forcefetch(self, url, ud, d): + if 'rev' in ud.parm: + revTag = ud.parm['rev'] + else: + revTag = "tip" + return revTag == "tip" + + def localpath(self, url, ud, d): if not "module" in ud.parm: raise MissingParameterError("hg method needs a 'module' parameter")
@@ -108,7 +116,7 @@ """Fetch url""" # try to use the tarball stash - if Fetch.try_mirror(d, ud.localfile): + if not self.forcefetch(loc, ud, d) and Fetch.try_mirror(d, ud.localfile): bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping hg checkout." % ud.localpath) return
--
Dr Peter Chubb www.nicta.com.au peter DOT chubb AT nicta.com.au
http://www.ertos.nicta.com.au ERTOS within National ICT Australia
From Imagination to Impact Imagining the (ICT) Future