(hgHost, repoPath, protocol='https', revision=None,
                filename=None)
construct a valid hg url from a base hg url (hg.mozilla.org),
    repoPath, revision and possible filename
construct a valid hg url from a base hg url (hg.mozilla.org),
    repoPath, revision and possible filename
construct a valid hg url from a base hg url ( hg . mozilla . org ) repoPath revision and possible filename
def make_hg_url(hgHost, repoPath, protocol='https', revision=None,
                filename=None):
    """construct a valid hg url from a base hg url (hg.mozilla.org),
    repoPath, revision and possible filename"""
    base = '%s://%s' % (protocol, hgHost)
    repo = '/'.join(p.strip('/') for p in [base, repoPath])
    if not filename:
        if not revision:
            return repo
        else:
            return '/'.join([p.strip('/') for p in [repo, 'rev', revision]])
    else:
        assert revision
        return '/'.join([p.strip('/') for p in [repo, 'raw-file', revision, filename]])
def make_hg_url ( hgHost , repoPath , protocol = 'https' , revision = None , filename = None ) : base = '%s://%s' % ( protocol , hgHost ) repo = '/' . join ( p . strip ( '/' ) for p in [ base , repoPath ] ) if not filename : if not revision : return repo else : return '/' . join ( [ p . strip ( '/' ) for p in [ repo , 'rev' , revision ] ] ) else : assert revision return '/' . join ( [ p . strip ( '/' ) for p in [ repo , 'raw-file' , revision , filename ] ] )