EDIT: It seems as if the MercurialSCM plugin hardcodes the update to use the --clean option. See this line. Anyone have any ideas what's the idea?

I have the following checkout step in my Jenkinsfile:

        scm: [
            $class: "MercurialSCM",
            source: "ssh://[email protected]/xxxxx/${repo}",
            credentialsId: "jenkins",
            revision: params[branch] ? params[branch] : "default",
            subdir: (repo == "f8_root") ? "" : "aarch64/${repo}",
            clean: false,
        poll: true,

The argument for clean is set to false. But, the plugin still seems to issue an update with the --clean option. From the logs:

[Pipeline] checkout
[f8_fw] $ hg showconfig paths.default
[f8_fw] $ hg pull --rev feature/test-framework
pulling from ssh://[email protected]/doblesc/f8_fw
no changes found
[f8_fw] $ hg update --clean --rev feature/test-framework

How can I fix this?

  • 1
    Maybe a dumb question, but have you tried omitting the clean parameter altogether? As far as I can tell, the default is not to do a clean build. So if you omit clean, it should follow the default behavior. Unfortunately I don't have any mercurial repositories available to test with, so I can't verify this myself.
    – jayhendren
    Jan 30, 2019 at 17:47
  • Yes, I did. Interestingly, I found that the MercurialSCM hardcodes the --clean option for the update. See edit to the OP.
    – Ziffusion
    Jan 30, 2019 at 18:01
  • I suggest filing a bug report
    – jayhendren
    Jan 30, 2019 at 19:41

1 Answer 1


Seems like --clean is hardcoded into the MercurialSCM Jenkins plugin.

See OP for the link to the culprit code.

I have opened up a ticket on Jenkins jira.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.