Patchwork [3,of,4,V2] shelve: new output format for shelve listings

login
register
mail settings
Submitter David Soria Parra
Date Oct. 1, 2013, 10:29 a.m.
Message ID <03f034cfe01eb249cf4a.1380623363@achird.localdomain>
Download mbox | patch
Permalink /patch/2684/
State Accepted
Commit a3b2858827243f7059bf72be7f17976ef5b9e2c5
Headers show

Comments

David Soria Parra - Oct. 1, 2013, 10:29 a.m.
# HG changeset patch
# User David Soria Parra <dsp@experimentalworks.net>
# Date 1380622831 -7200
#      Tue Oct 01 12:20:31 2013 +0200
# Node ID 03f034cfe01eb249cf4a3856d9a3d0e3e01deed7
# Parent  552cab75b8442c4aa110b9d0349939061913f913
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

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -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:
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -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