Page MenuHomeSoftware Heritage

Disable user customization in Mercurial tests
ClosedPublic

Authored by Alphare on Feb 22 2021, 11:51 AM.

Diff Detail

Repository
rDLDHG Mercurial loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5124 (id=18323)

Rebasing onto d8f28b70fa...

Current branch diff-target is up to date.
Changes applied before test
commit 728c56c46373113217a8dc0caea1de6e849a2879
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Mon Feb 22 11:49:21 2021 +0100

    Disable user customization in Mercurial tests
    
    Tests can break when ran in user environments if the output is
    customized, either by config options (like aliases) or extensions.

See https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/152/ for more details.

This revision is now accepted and ready to land.Feb 22 2021, 12:02 PM

Shouldn't it also happen outside tests?

Shouldn't it also happen outside tests?

My reasonning for only adding this to tests is that I'm assuming whatever machine is doing the loading may have a good reason to load extensions/have some sort of config and that it should be isolated enough from developpers. But it wouldn't hurt to be proactive about it either.

I am not sure where this change would need to be done, though.

Possibly this should be scope="session"? Since this trickles down to all subprocesses. That's a minor optimization, but might as well not be wasteful for no reason.

My reasonning for only adding this to tests is that I'm assuming whatever machine is doing the loading may have a good reason to load extensions/have some sort of config and that it should be isolated enough from developpers. But it wouldn't hurt to be proactive about it either.

But that's not good if it changes the output format; and it may make hg behave differently, doesn't it?

I am not sure where this change would need to be done, though.

When calling subprocess function, there is an env attribute. We could use the opportunity to filter out the entire env except $PATH

Possibly this should be scope="session"? Since this trickles down to all subprocesses. That's a minor optimization, but might as well not be wasteful for no reason.

sure

  • Disable user customization in Mercurial tests
  • Sort imports according to isort rules
  • Filter hg subprocess environment to the minimum
  • Make Mercurial's behavior predictable for scripts

Build has FAILED

Patch application report for D5124 (id=18348)

Rebasing onto d8f28b70fa...

Current branch diff-target is up to date.
Changes applied before test
commit cea44f672ead5fa4bb198b341d40c0d55cac7eed
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:54:54 2021 +0100

    Make Mercurial's behavior predictable for scripts
    
    This change adds two environment variables that have been supported for
    10+ years by Mercurial to make its output predictable for use in
    scripts. This was already done by a previous patch in tests, but it is
    also (even more?) useful here.

commit d2dad04d27d795eda33cb02a9706b8286bb28f1e
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:50:26 2021 +0100

    Filter `hg` subprocess environment to the minimum
    
    We don't want the user's environment to affect `hg`'s behavior. The bare
    minimum is the `PATH`. In the next patch, we add the Mercurial-specific
    variables to ensure a "vanilla" behavior.

commit 58abf7790a7bad36c067e9e6a067ad53abc49bd7
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:48:07 2021 +0100

    Sort imports according to `isort` rules
    
    The next patch will add an import and `isort` was complaining. It appears
    that this file hasn't been changed since the `isort` change.

commit 4805abbb440ef151caf2e68db448424dc5d41c31
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Mon Feb 22 11:49:21 2021 +0100

    Disable user customization in Mercurial tests
    
    Tests can break when ran in user environments if the output is
    customized, either by config options (like aliases) or extensions.

Link to build: https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/154/
See console output for more information: https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/154/console

  • Disable user customization in Mercurial tests
  • Sort imports according to isort rules
  • Filter hg subprocess environment to the minimum
  • Make Mercurial's behavior predictable for scripts

Build is green

Patch application report for D5124 (id=18350)

Rebasing onto d8f28b70fa...

Current branch diff-target is up to date.
Changes applied before test
commit ef3a2ba79ea9646a69af8683f26d51a0173189e5
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:54:54 2021 +0100

    Make Mercurial's behavior predictable for scripts
    
    This change adds two environment variables that have been supported for
    10+ years by Mercurial to make its output predictable for use in
    scripts. This was already done by a previous patch in tests, but it is
    also (even more?) useful here.

commit 09b3c6daa7ddf270894302c8501ef9a6ce17102c
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:50:26 2021 +0100

    Filter `hg` subprocess environment to the minimum
    
    We don't want the user's environment to affect `hg`'s behavior. The bare
    minimum is the `PATH`. In the next patch, we add the Mercurial-specific
    variables to ensure a "vanilla" behavior.

commit 70dcbb67e6f5169dffdeaf5aed03c462b448baf8
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Tue Feb 23 15:48:07 2021 +0100

    Sort imports according to `isort` rules
    
    The next patch will add an import and `isort` was complaining. It appears
    that this file hasn't been changed since the `isort` change.

commit 8c81de02c9b3dfb25c1751a947665694ad7ebd6b
Author: Raphaël Gomès <rgomes@octobus.net>
Date:   Mon Feb 22 11:49:21 2021 +0100

    Disable user customization in Mercurial tests
    
    Tests can break when ran in user environments if the output is
    customized, either by config options (like aliases) or extensions.

See https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/155/ for more details.