shelve: add `update --shelve` if shelve extension is loaded
Needs ReviewPublic

Authored by pulkit on Thu, May 9, 7:41 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

A lot of times, I need to update to some other cset with dirty working
directory. Good number of times, I run hg shelve and hg update in order.

Let's add --shelve flag to hg update which will shelve wdir changes before
running the update.

.. feature::

`--shelve` flag to `hg update` if shelve extension is enabled. The flag will
shelve working directory changes before performing update.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped
pulkit created this revision.Thu, May 9, 7:41 AM
martinvonz added inline comments.
tests/test-shelve.t
1177

It's not clear that this is related to --shelve. Can we instead first check if the working is dirty? Or make this message more explicit. The former seems better if you think users (including you) will want to set defaults.update=--shelve.

Should this abort if subrepos are present, since you can't shelve a subrepo? No -S is available on update, but maybe looking for .hgsub with any contents is good enough?

I don't have time to play with it right now, but I know updating a dirty repo with dirty subrepos is massively confusing already.

Should this abort if subrepos are present, since you can't shelve a subrepo? No -S is available on update, but maybe looking for .hgsub with any contents is good enough?

On second thought, maybe just check for dirty subrepos so that this isn’t completely incompatible with subrepos.