1
votes

It seems like ShelveExtension only shelves your modified files leaving untracked or deleted.

I am new to Mercurial and coming from git so for me this is not expected.

Even bigger problem I am not able to hg unshelve with what I assume is an error message.

See below:

unshelving change 'main'

temporarily committing pending changes (restore with 'hg unshelve --abort')

rebasing shelved changes

abort: uncommitted changes

Is that an expected behavior and I am just missing something?

How could I unshelve my modified files without restoring/committing/etc.?

Is there an extension which behaves exactly like git stash?

Steps to reproduce:

enter image description here

Environment:

OS: Windows 8

Mercurial: Mercurial Distributed SCM (version 3.0.1). Installed as cygwin /usr/bin/hg (Tortoisehg is not installed, Windows hg is installed but not used)

Extension: ShelveExtension.

1

1 Answers

3
votes

Is that an expected behavior and I am just missing something?

Yes, this is normal behavior. You need to do hg addremove (or manually hg add and hg rm the individual files) if you want Mercurial to track file creation and deletion. Renaming should be done with hg mv. This is vaguely similar to git add, except that you do not need to do it for modified files.

When you unshelve, your working directory should be clean. At the very least, it should not have any missing files (prefixed with ! in hg st) nor any modified files (prefixed with M). You can always make a temporary commit and hg strip it later.

How could I unshelve my modified files without restoring/committing/etc.?

There's no sane way to do this in the general case. What if the shelf contains changes to a file which no longer exists? If the file deletion had been committed, you could generate a patch conflict, and that's what Mercurial does. But without a commit to conflict with, there's no obvious response to this situation.

Is there an extension which behaves exactly like git stash?

Not to my knowledge, but this is beyond the scope of StackOverflow.