[PATCH 3 of 8 shelve-ext] shelve: move argument processing out of the locked code

Kostia Balytskyi ikostia at fb.com
Wed Nov 9 09:58:08 EST 2016


On 11/9/16, 10:04 AM, "Durham Goode" <durham at fb.com> wrote:

    On 11/8/16 1:51 PM, Kostia Balytskyi wrote:
    
    > # HG changeset patch
    > # User Kostia Balytskyi <ikostia at fb.com>
    > # Date 1478527237 28800
    > #      Mon Nov 07 06:00:37 2016 -0800
    > # Node ID b75505c45921802d9480f1629fca4fdd7f9394d3
    > # Parent  334f462a1c345e5fa453ea641281ef9713789718
    > shelve: move argument processing out of the locked code
    I'd always mention why we're making this change, in addition to what the 
    change is.  Otherwise this patch just looks like unnecessary code churn 
    (though I'm sure there's a reason).
Well, there’s not a serious reason. I just thought that since I am doing large-ish shelve refactoring, I will move as many things out of lock as possible and cmd-option assigning to variables seemed like a good candidate. I will omit this commit in the v2.

    >
    > diff --git a/hgext/shelve.py b/hgext/shelve.py
    > --- a/hgext/shelve.py
    > +++ b/hgext/shelve.py
    > @@ -298,7 +298,8 @@ def _docreatecmd(ui, repo, pats, opts):
    >       parent = parents[0]
    >       origbranch = wctx.branch()
    >   
    > -    # we never need the user, so we use a generic user for all shelve operations
    > +    # we never need the user, so we use a
    > +    # generic user for all shelve operations
    >       user = 'shelve at localhost'
    >   
    >       if parent.node() != nodemod.nullid:
    > @@ -309,6 +310,9 @@ def _docreatecmd(ui, repo, pats, opts):
    >       if not opts.get('message'):
    >           opts['message'] = desc
    >       name = getshelvename(repo, parent, opts)
    > +    interactive = opts.get('interactive', False)
    > +    includeunknown = (opts.get('unknown', False) and
    > +                      not opts.get('addremove', False))
    >   
    >       lock = tr = None
    >       try:
    > @@ -318,10 +322,6 @@ def _docreatecmd(ui, repo, pats, opts):
    >           # pull races. ensure we don't print the abort message to stderr.
    >           tr = repo.transaction('commit', report=lambda x: None)
    >   
    > -        interactive = opts.get('interactive', False)
    > -        includeunknown = (opts.get('unknown', False) and
    > -                          not opts.get('addremove', False))
    > -
    >           extra={}
    >           if includeunknown:
    >               s = repo.status(match=scmutil.match(repo[None], pats, opts),
    > _______________________________________________
    > Mercurial-devel mailing list
    > Mercurial-devel at mercurial-scm.org
    > https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DQIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=32Le2MPDkI3ZXTxso0AkblXXgdoLzKA2dTGqmvQlpYY&s=RaUpD8EqP_sb6Dkg_j2H7-QE3P5a81HLM1xmz70IPl4&e=
    
    



More information about the Mercurial-devel mailing list