[Bug 6123] New: hg shelve has no information about branches

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Apr 23 09:38:23 UTC 2019


https://bz.mercurial-scm.org/show_bug.cgi?id=6123

            Bug ID: 6123
           Summary: hg shelve has no information about branches
           Product: Mercurial
           Version: 4.9
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: shelve
          Assignee: bugzilla at mercurial-scm.org
          Reporter: faheem at faheem.info
                CC: mercurial-devel at mercurial-scm.org

The shelve extension is of significant importance to everyday workflows,
because when one is switching from one branch to another, either named branches
or topic branches, Mercurial will often prevent one from doing so, saying that
there are conflicting changes. This typically looks like:

abort: conflicting changes
(commit or update --clean to discard changes)

So, in many cases, one is forced to save local changes before switching
branches. The usual tool to do so appears to be the shelve extension. If there
is something better, please let me know.

But if one has shelved on branch A, and unwittingly tries to unshelve on branch
B, which is easy to do, because the shelved changes do not by default,
themselves contain any information about which branch they originate from, one
runs into the kind of situation shown in the transcript below.

faheem at orwell:~/personal/business$ hg unshelve
unshelving change 'default-01'
rebasing shelved changes
file 'business/foo.tex' was deleted in local [shelve] but was modified in other
[working-copy].
What do you want to do?
use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
faheem at orwell:~/personal/business$ hg shelve 
abort: unshelve already in progress
(use 'hg unshelve --continue' or 'hg unshelve --abort')
faheem at orwell:~/personal/business$ hg unshelve --abort
unshelve of 'default-01' aborted
faheem at orwell:~/personal/business$ hg shelve 
nothing changed

Notice:

a) currently `hg shelve` doesn't give one a clean option to back out if things
look dicey. You first have to attempt an unshelve, choose the unresolved option
(which isn't obviously the right choice), and after that, one can do a
`unshelve --abort`, which the extension does not tell one about till one tries
to do a shelve.

b) `hg unshelve` makes no attempt to warn the user that these local changes
come from another branch. I suppose, again, because it does not have that
information.

It's possible an approach that is more integrated with version control would be
better. Or maybe one is supposed to just keep committing everything all the
time, so this situation doesn't arise. But I don't think the latter is a
reasonable expectation. Regardless, if one is to use `hg shelve`, a version
that records branch information and refuses to proceed if the recorded branch
does not match the current branch would be much preferable to the current state
of affairs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list