summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/hg.py
diff options
context:
space:
mode:
authorVolker Vogelhuber <v.vogelhuber@digitalendoscopy.de>2013-11-01 17:53:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-01 17:55:57 +0000
commitdc3d6d73e44802c203b3f7247f6f212acc2f69bf (patch)
treecf65ad9658609845571bd2843d9b3639ca4397c7 /lib/bb/fetch2/hg.py
parenta5abd1826f34e6a7eefa837620b846e9b62ae758 (diff)
downloadbitbake-contrib-dc3d6d73e44802c203b3f7247f6f212acc2f69bf.tar.gz
fetch/hg: Improve user/password handling
Trying to use a server with username and password authentication within the URL of the SRC_URI variable doesn't appear to work. This patch adds the missing parts to the hg fetcher to make this work properly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/hg.py')
-rw-r--r--lib/bb/fetch2/hg.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch2/hg.py
index b1c8675dd..cf214816b 100644
--- a/lib/bb/fetch2/hg.py
+++ b/lib/bb/fetch2/hg.py
@@ -92,7 +92,10 @@ class Hg(FetchMethod):
if not ud.user:
hgroot = host + ud.path
else:
- hgroot = ud.user + "@" + host + ud.path
+ if ud.pswd:
+ hgroot = ud.user + ":" + ud.pswd + "@" + host + ud.path
+ else:
+ hgroot = ud.user + "@" + host + ud.path
if command == "info":
return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module)
@@ -112,7 +115,10 @@ class Hg(FetchMethod):
# do not pass options list; limiting pull to rev causes the local
# repo not to contain it and immediately following "update" command
# will crash
- cmd = "%s pull" % (basecmd)
+ if ud.user and ud.pswd:
+ cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull" % (basecmd, ud.user, ud.pswd, proto)
+ else:
+ cmd = "%s pull" % (basecmd)
elif command == "update":
cmd = "%s update -C %s" % (basecmd, " ".join(options))
else: