Skip to contentSkip to conversation

HG clone with username and password in url

PATCH Volker Vogelhuber 1 participant 1 message May 9, 2014

lore
Share & tools
lore
#0 lore raw

Unfortunately my last patch for the hg fetcher (in dylan's bitbake version) with username and password was incomplete. The following patch hopefully fixes all cases where username and pasword authorization may be required.

From ed81d51a391c39aa42d01bf9ebf00e9f88dd9c90 Mon Sep 17 00:00:00 2001
From: Volker Vogelhuber <[email protected]>
Date: Fri, 9 May 2014 10:10:13 +0200
Subject: [PATCH] fix cloning of mercurial repository with username and
password specified in url

---
 bitbake/lib/bb/fetch2/hg.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/hg.py +4 -1
index cf21481..8c41d4d 100644
@@ -110,7 +110,10 @@ class Hg(FetchMethod):
             options.append("-r %s" % ud.revision)
 
         if command == "fetch":
-            cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)
+            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\" clone %s %s://%s/%s %s" % (basecmd, ud.user, ud.pswd, " ".join(options), proto, hgroot, ud.module, ud.module)
+            else:
+                cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)	      
         elif command == "pull":
             # do not pass options list; limiting pull to rev causes the local
             # repo not to contain it and immediately following "update" command
Signature · 1 line
1.9.1