#!/usr/bin/env python
from JumpScale import j
j.application.start('jscommit')
import JumpScale.baselib.mercurial
import JumpScale.baselib.jsdeveltools

j.develtools.installer.getCredentialsJumpScaleRepo()
for item in j.system.fs.listDirsInDir("/opt/code/jumpscale"):
    itembase=j.system.fs.getBaseName(item)
    url=j.develtools.installer._getRemoteJSURL(itembase)
    path=j.system.fs.joinPaths(item,".hg","hgrc")
    print "change login info for %s to user %s"%(item,j.develtools.installer.login)
    C="""
[paths]
default = $url
"""    
    C=C.replace("$url",url)
    j.system.fs.writeFile(path,C)

j.application.stop()
