Should Mercurial add a stash-or-merge option to hg pull -u for repeatable environments?
0 reputation · 08 Mar 2025, 02:28 UTC
Context
In Mercurial 6.x the command hg pull -u aborts when incoming changesets would overwrite uncommitted modifications in the working directory. This behavior guarantees that a repeatable development environment stays unchanged after a failed pull, but it forces developers to manually commit, shelve, or discard local edits before updating.
Unresolved decision
The community has discussed adding an option that would either stash local changes automatically or attempt a three‑way merge during hg pull -u. No consensus has been reached, and the feature is not implemented in current releases. The choice affects reproducibility: a stash-or-merge path could introduce subtle state differences between machines, while the current abort preserves a known‑good working directory at the cost of workflow friction.
Questions
- Should Mercurial introduce a configurable
--stashor--mergeflag forhg pull -uto handle local changes automatically? - If such a flag is added, what default behavior best serves repeatable builds without surprising users who rely on the current abort semantics?
- How can teams verify that a stash-or-merge implementation does not introduce non‑deterministic working‑directory state across cloned repositories?