Expand 'subdir' to allow for environment variables/parameterization

I have a build job that is used by lots of other jobs, the job is 'specialised' via the user of build parameters (this allows the child jobs to control what the parent job does). One aspect the children need to be able to control is the Mercurial subdir that the repository is cloned into. The getPollEnvironment function below is lifted from the git Jenkins plugin.