changeset 19855:a3b285882724

shelve: new output format for shelve listings Use a more condensed and mercurial-like output format for shelve listing. We don't prefix the message with 'shelved from...' anymore as our default name contains the branch name or the user used his own name. To avoid just printing the last commit message, we drop writing the description to stdout. old output: default [1s ago] shelved from default (01ba9745): create conflict new output: default (1s ago) create conflict
author David Soria Parra <dsp@experimentalworks.net>
date Tue, 01 Oct 2013 12:20:31 +0200
parents 49d4919d21c2
children 28b1b7b9b4a9
files hgext/shelve.py tests/test-shelve.t
diffstat 2 files changed, 11 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Thu Aug 29 09:22:13 2013 -0700
+++ b/hgext/shelve.py	Tue Oct 01 12:20:31 2013 +0200
@@ -160,7 +160,6 @@
 
     if parent.node() != nullid:
         desc = parent.description().split('\n', 1)[0]
-        desc = _('shelved from %s (%s): %s') % (label, str(parent)[:8], desc)
     else:
         desc = '(empty repository)'
 
@@ -223,7 +222,6 @@
 
         if ui.formatted():
             desc = util.ellipsis(desc, ui.termwidth())
-        ui.status(desc + '\n')
         ui.status(_('shelved as %s\n') % name)
         hg.update(repo, parent.node())
     finally:
@@ -292,10 +290,10 @@
             continue
         ui.write(' ' * (16 - len(sname)))
         used = 16
-        age = '[%s]' % templatefilters.age(util.makedate(mtime))
+        age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True)
         ui.write(age, label='shelve.age')
-        ui.write(' ' * (18 - len(age)))
-        used += 18
+        ui.write(' ' * (12 - len(age)))
+        used += 12
         fp = open(name + '.patch', 'rb')
         try:
             while True:
--- a/tests/test-shelve.t	Thu Aug 29 09:22:13 2013 -0700
+++ b/tests/test-shelve.t	Tue Oct 01 12:20:31 2013 +0200
@@ -16,7 +16,6 @@
 shelving in an empty repo should be possible
 
   $ hg shelve
-  (empty repository)
   shelved as default
   0 files updated, 0 files merged, 5 files removed, 0 files unresolved
 
@@ -44,7 +43,6 @@
 
   $ echo a >> a/a
   $ hg shelve
-  shelved from default (bb4fec6d): second
   shelved as default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -74,7 +72,6 @@
 the common case - no options or filenames
 
   $ hg shelve
-  shelved from default (bb4fec6d): second
   shelved as default-01
   2 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg status -C
@@ -82,11 +79,11 @@
 ensure that our shelved changes exist
 
   $ hg shelve -l
-  default-01      [*]    shelved from default (bb4fec6d): second (glob)
-  default         [*]    shelved from default (bb4fec6d): second (glob)
+  default-01      (*)    second (glob)
+  default         (*)    second (glob)
 
   $ hg shelve -l -p default
-  default         [*]    shelved from default (bb4fec6d): second (glob)
+  default         (*)    second (glob)
   
   diff --git a/a/a b/a/a
   --- a/a/a
@@ -158,7 +155,7 @@
     c
   R b/b
   $ hg shelve -l --stat
-  wibble          [*]    wat (glob)
+  wibble          (*)    wat (glob)
    a/a |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
 
@@ -206,11 +203,11 @@
 ensure that we have a merge with unresolved conflicts
 
   $ hg heads -q
-  3:7ec047b69dc0
+  3:6ea6529cfc65
   2:ceefc37abe1e
   $ hg parents -q
   2:ceefc37abe1e
-  3:7ec047b69dc0
+  3:6ea6529cfc65
   $ hg status
   M a/a
   M b.rename/b
@@ -402,11 +399,10 @@
 test keep and cleanup
 
   $ hg shelve
-  shelved from default (be7e7968): create conflict
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg shelve --list
-  default         [*]    shelved from default (be7e7968): create conflict (glob)
+  default         (*)    create conflict (glob)
   $ hg unshelve --keep
   unshelving change 'default'
   adding changesets
@@ -415,6 +411,6 @@
   added 1 changesets with 1 changes to 7 files
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg shelve --list
-  default         [*]    shelved from default (be7e7968): create conflict (glob)
+  default         (*)    create conflict (glob)
   $ hg shelve --cleanup
   $ hg shelve --list