[PATCH 16 of 25 RFC] shelve: move createcmd next to _docreatecmd

Boris Feld boris.feld at octobus.net
Thu Jun 7 10:11:15 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1527585696 -7200
#      Tue May 29 11:21:36 2018 +0200
# Node ID 49bb8db412ebe0580d1a2d65edb218cf738f6bde
# Parent  fb3ee0a32dd588db82f7bfd7708cba25ad0d7c5c
# EXP-Topic internal-phase
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 49bb8db412eb
shelve: move createcmd next to _docreatecmd

It is simpler not to have to jump around the file all the time.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -319,12 +319,6 @@ def _aborttransaction(repo):
     tr.abort()
     repo.dirstate.restorebackup(None, backupname)
 
-def createcmd(ui, repo, pats, opts):
-    """subcommand that creates a new shelve"""
-    with repo.wlock():
-        cmdutil.checkunfinished(repo)
-        return _docreatecmd(ui, repo, pats, opts)
-
 def getshelvename(repo, parent, opts):
     """Decide on the name this shelve is going to have"""
     def gennames():
@@ -426,6 +420,12 @@ def _includeunknownfiles(repo, pats, opt
 def _finishshelve(repo):
     _aborttransaction(repo)
 
+def createcmd(ui, repo, pats, opts):
+    """subcommand that creates a new shelve"""
+    with repo.wlock():
+        cmdutil.checkunfinished(repo)
+        return _docreatecmd(ui, repo, pats, opts)
+
 def _docreatecmd(ui, repo, pats, opts):
     wctx = repo[None]
     parents = wctx.parents()


More information about the Mercurial-devel mailing list