summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/hg.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index 15d729e7b2..e21115debf 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -54,13 +54,6 @@ class Hg(FetchMethod):
54 else: 54 else:
55 ud.proto = "hg" 55 ud.proto = "hg"
56 56
57 ud.setup_revisions(d)
58
59 if 'rev' in ud.parm:
60 ud.revision = ud.parm['rev']
61 elif not ud.revision:
62 ud.revision = self.latest_revision(ud, d)
63
64 # Create paths to mercurial checkouts 57 # Create paths to mercurial checkouts
65 hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \ 58 hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \
66 ud.host, ud.path.replace('/', '.')) 59 ud.host, ud.path.replace('/', '.'))
@@ -74,6 +67,13 @@ class Hg(FetchMethod):
74 ud.localfile = ud.moddir 67 ud.localfile = ud.moddir
75 ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg" 68 ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg"
76 69
70 ud.setup_revisions(d)
71
72 if 'rev' in ud.parm:
73 ud.revision = ud.parm['rev']
74 elif not ud.revision:
75 ud.revision = self.latest_revision(ud, d)
76
77 ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") 77 ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS")
78 78
79 def need_update(self, ud, d): 79 def need_update(self, ud, d):
@@ -139,7 +139,7 @@ class Hg(FetchMethod):
139 cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull" % (ud.basecmd, ud.user, ud.pswd, proto) 139 cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull" % (ud.basecmd, ud.user, ud.pswd, proto)
140 else: 140 else:
141 cmd = "%s pull" % (ud.basecmd) 141 cmd = "%s pull" % (ud.basecmd)
142 elif command == "update": 142 elif command == "update" or command == "up":
143 if ud.user and ud.pswd: 143 if ud.user and ud.pswd:
144 cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" update -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options)) 144 cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" update -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options))
145 else: 145 else:
@@ -247,12 +247,19 @@ class Hg(FetchMethod):
247 247
248 scmdata = ud.parm.get("scmdata", "") 248 scmdata = ud.parm.get("scmdata", "")
249 if scmdata != "nokeep": 249 if scmdata != "nokeep":
250 proto = ud.parm.get('protocol', 'http')
250 if not os.access(os.path.join(codir, '.hg'), os.R_OK): 251 if not os.access(os.path.join(codir, '.hg'), os.R_OK):
251 logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'") 252 logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'")
252 runfetchcmd("%s init %s" % (ud.basecmd, codir), d) 253 runfetchcmd("%s init %s" % (ud.basecmd, codir), d)
253 logger.debug(2, "Unpack: updating source in '" + codir + "'") 254 logger.debug(2, "Unpack: updating source in '" + codir + "'")
254 runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir) 255 if ud.user and ud.pswd:
255 runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir) 256 runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull %s" % (ud.basecmd, ud.user, ud.pswd, proto, ud.moddir), d, workdir=codir)
257 else:
258 runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir)
259 if ud.user and ud.pswd:
260 runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" up -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, revflag), d, workdir=codir)
261 else:
262 runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir)
256 else: 263 else:
257 logger.debug(2, "Unpack: extracting source to '" + codir + "'") 264 logger.debug(2, "Unpack: extracting source to '" + codir + "'")
258 runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir) 265 runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir)