Merge pull request #568 from howbazaar/fix-envcmd-ensure

Envcmd is more forgiving during init.

Don't error in envcmd if we can't work out the environment until we actually need it.
Resolve conflicts
Merge pull request #580 from wallyworld/fix-envcmd-ensure-1.20

Merge pull request #568 from howbazaar/fix-envcmd-ensure

Backport from trunk

Envcmd is more forgiving during init.

Don't error in envcmd if we can't work out the environment until we actually need it.