[PATCH 8 of 9] shelve: status messages from unshelve

Mads Kiilerich mads at kiilerich.com
Sun Feb 9 18:01:17 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1391990067 -3600
#      Mon Feb 10 00:54:27 2014 +0100
# Node ID 18170d3588ff3bcce64a866e1db848b8bfb371b2
# Parent  04610a5b38ce9ca5d2274710cd47749f291ddfa0
shelve: status messages from unshelve

It was hard for the user to know what was going on when unshelving - especially
if the user had to resolve conflicts and thus got to see the intermediate
states.

Seeing that pending changes was gone could scare the user, make him panic, and
do stuff that really made him lose data.

Merging (both when rebasing and with pending changes) also requires some
understanding of where in the process you are and what you are merging.

To help the user we now show a couple of status messages (when relevant):
  temporarily committing pending changes (restore with 'hg unshelve --abort')
  rebasing shelved changes

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -537,6 +537,8 @@ def unshelve(ui, repo, *shelved, **opts)
         # Store pending changes in a commit
         m, a, r, d = repo.status()[:4]
         if m or a or r or d:
+            ui.status(_("temporarily committing pending changes "
+                        "(restore with 'hg unshelve --abort')\n"))
             def commitfunc(ui, repo, message, match, opts):
                 hasmq = util.safehasattr(repo, 'mq')
                 if hasmq:
@@ -572,6 +574,7 @@ def unshelve(ui, repo, *shelved, **opts)
         # If the shelve is not immediately on top of the commit
         # we'll be merging with, rebase it to be on top.
         if tmpwctx.node() != shelvectx.parents()[0].node():
+            ui.status(_('rebasing shelved changes\n'))
             try:
                 rebase.rebase(ui, repo, **{
                     'rev' : [shelvectx.rev()],
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -100,6 +100,8 @@ local edits should not prevent a shelved
   $ printf "z\na\n" > a/a
   $ hg unshelve --keep
   unshelving change 'default-01'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
   merging a/a
 
   $ hg revert --all -q
@@ -180,6 +182,8 @@ force a conflicted merge to occur
 
   $ hg unshelve
   unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
   merging a/a
   warning: conflicts during merge.
   merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
@@ -363,6 +367,8 @@ if we resolve a conflict while unshelvin
 
   $ HGMERGE=true hg unshelve
   unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
   merging a/a
   $ hg parents -q
   4:33f7f61e6c5e
@@ -436,6 +442,7 @@ shelve should leave dirstate clean (issu
   saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-backup.hg (glob)
   $ hg unshelve
   unshelving change 'default'
+  rebasing shelved changes
   $ hg status
   M z
 
@@ -461,6 +468,7 @@ shelve should only unshelve pending chan
   $ hg up -q 1
   $ hg unshelve
   unshelving change 'default'
+  rebasing shelved changes
   $ hg status
   A d
 
@@ -473,6 +481,7 @@ unshelve should work on an ancestor of t
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg unshelve
   unshelving change 'default'
+  rebasing shelved changes
   $ hg status
   A d
 


More information about the Mercurial-devel mailing list