Patchwork [4,of,5] shelve: use `shelf`

login
register
mail settings
Submitter timeless@mozdev.org
Date Oct. 15, 2015, 9:05 p.m.
Message ID <cbe944c94864c2bdc303.1444943139@waste.org>
Download mbox | patch
Permalink /patch/11122/
State Deferred
Headers show

Comments

timeless@mozdev.org - Oct. 15, 2015, 9:05 p.m.
# HG changeset patch
# User timeless@mozdev.org
# Date 1444806915 14400
#      Wed Oct 14 03:15:15 2015 -0400
# Node ID cbe944c94864c2bdc303ed19e387de4b94c6383e
# Parent  31bdbd8519204c15d79d92a8290bc2f48eba8914
shelve: use `shelf`
Matt Mackall - Oct. 19, 2015, 10:17 p.m.
On Thu, 2015-10-15 at 16:05 -0500, timeless@mozdev.org wrote:
> # HG changeset patch
> # User timeless@mozdev.org
> # Date 1444806915 14400
> #      Wed Oct 14 03:15:15 2015 -0400
> # Node ID cbe944c94864c2bdc303ed19e387de4b94c6383e
> # Parent  31bdbd8519204c15d79d92a8290bc2f48eba8914
> shelve: use `shelf`

It's actually not clear that this should be the name of the thing
created when shelving. When you shelve a book.. it doesn't become a
shelf, it's merely a shelved book. There are indeed a couple references
to "shelf" in the code:

$ hgrep shelf
hgext/shelve.py:    """subcommand that displays a single shelf"""
hgext/shelve.py:        raise error.Abort(_("--%s expects a single
shelf") % subcommand)
hgext/shelve.py:    shelfname = pats[0]
hgext/shelve.py:    if not shelvedfile(repo, shelfname,
'patch').exists():
hgext/shelve.py:        raise error.Abort(_("cannot find shelf %s") %
shelfname)

..but there are actually many more visible references to "shelved
changed", which is probably superior.

-- 
Mathematics is the supreme nostalgia of our time.
timeless - Oct. 20, 2015, 12:19 a.m.
Matt Mackall wrote:
> It's actually not clear that this should be the name of the thing
> created when shelving. When you shelve a book.. it doesn't become a
> shelf, it's merely a shelved book.

> There are indeed a couple references to "shelf" in the code:


> ..but there are actually many more visible references to "shelved
> changed", which is probably superior.

I don't have an opinion, I tossed this out to shake the tree because
as you can see, there's definitely an inconsistency.
I'm happy to send a patch to change it the other direction if you're open to it.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -90,7 +90,7 @@ 
         except IOError as err:
             if err.errno != errno.ENOENT:
                 raise
-            raise error.Abort(_("shelved change '%s' not found") % self.name)
+            raise error.Abort(_("shelf '%s' not found") % self.name)
 
     def applybundle(self):
         fp = self.opener()
@@ -290,7 +290,7 @@ 
 
         if name:
             if shelvedfile(repo, name, 'hg').exists():
-                raise error.Abort(_("a shelved change named '%s' already exists"
+                raise error.Abort(_("a shelf named '%s' already exists"
                                    ) % name)
         else:
             for n in gennames():
@@ -303,9 +303,9 @@ 
 
         # ensure we are not creating a subdirectory or a hidden file
         if '/' in name or '\\' in name:
-            raise error.Abort(_('shelved change names may not contain slashes'))
+            raise error.Abort(_('shelf names may not contain slashes'))
         if name.startswith('.'):
-            raise error.Abort(_("shelved change names may not start with '.'"))
+            raise error.Abort(_("shelf names may not start with '.'"))
         interactive = opts.get('interactive', False)
 
         def interactivecommitfunc(ui, repo, *pats, **opts):
@@ -369,7 +369,7 @@ 
     except OSError as err:
         if err.errno != errno.ENOENT:
             raise
-        raise error.Abort(_("shelved change '%s' not found") % name)
+        raise error.Abort(_("shelf '%s' not found") % name)
     finally:
         lockmod.release(wlock)
 
@@ -638,7 +638,7 @@ 
         basename = shelved[0]
 
     if not shelvedfile(repo, basename, 'patch').exists():
-        raise error.Abort(_("shelved change '%s' not found") % basename)
+        raise error.Abort(_("shelf '%s' not found") % basename)
 
     oldquiet = ui.quiet
     wlock = lock = tr = None