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

login
register
mail settings
Submitter David Soria Parra
Date Sept. 17, 2013, 3:55 p.m.
Message ID <bc1dc2bd16d7ba0e44c7.1379433320@achird.localdomain>
Download mbox | patch
Permalink /patch/2510/
State Superseded, archived
Commit a3b2858827243f7059bf72be7f17976ef5b9e2c5
Headers show

Comments

David Soria Parra - Sept. 17, 2013, 3:55 p.m.
# HG changeset patch
# User David Soria Parra <dsp@experimentalworks.net>
# Date 1379432863 -7200
#      Tue Sep 17 17:47:43 2013 +0200
# Node ID bc1dc2bd16d7ba0e44c7756ca24153ed9c1127d3
# Parent  4a6bc39240c0f556ab3ab7eabfde347aadba3287
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
@@ -167,7 +167,6 @@ 
         return repo.commit(message, user, opts.get('date'), match)
 
     desc = parent.description().split('\n', 1)[0]
-    desc = _('shelved from %s (%s): %s') % (label, str(parent)[:8], desc)
 
     if not opts['message']:
         opts['message'] = desc
@@ -221,7 +220,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())
         repair.strip(ui, repo, [node], backup='none', topic='shelve')
@@ -289,10 +287,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
@@ -35,7 +35,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
 
@@ -65,7 +64,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
@@ -73,11 +71,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
@@ -149,7 +147,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(-)
 
@@ -197,11 +195,11 @@ 
 ensure that we have a merge with unresolved conflicts
 
   $ hg heads -q
-  3:da6db56b46f7
+  3:b1ebf939e049
   2:ceefc37abe1e
   $ hg parents -q
   2:ceefc37abe1e
-  3:da6db56b46f7
+  3:b1ebf939e049
   $ hg status
   M a/a
   M b.rename/b
@@ -392,10 +390,9 @@ 
 test 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 shelve --cleanup
   $ hg shelve --list