Patchwork [evolve-ext-V6] code hygiene

login
register
mail settings
Submitter Shusen LIU
Date Feb. 3, 2016, 4:21 a.m.
Message ID <9e49992bd33cc58fd6c8.1454473300@dev1221.lla1.facebook.com>
Download mbox | patch
Permalink /patch/12942/
State Changes Requested
Headers show

Comments

Shusen LIU - Feb. 3, 2016, 4:21 a.m.
# HG changeset patch
# User Shusen LIU <liushusen@fb.com>
# Date 1454473154 28800
#      Tue Feb 02 20:19:14 2016 -0800
# Node ID 9e49992bd33cc58fd6c8a383652e85d9e604785b
# Parent  de43a3e6b358f685e60fb0a64f0243b3eddb0a13
code hygiene

using two return statements rather than assignment and then return.
Pierre-Yves David - Feb. 3, 2016, 9:18 p.m.
On 02/03/2016 04:21 AM, Shusen LIU wrote:
> # HG changeset patch
> # User Shusen LIU <liushusen@fb.com>
> # Date 1454473154 28800
> #      Tue Feb 02 20:19:14 2016 -0800
> # Node ID 9e49992bd33cc58fd6c8a383652e85d9e604785b
> # Parent  de43a3e6b358f685e60fb0a64f0243b3eddb0a13
> code hygiene

Please follow the Mercurial commit message convention here. (also, this 
is not a V6, that's the first time you send this patch.

>
> using two return statements rather than assignment and then return.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -3748,7 +3748,7 @@
>          repo.dirstate.setbranch(orig.branch())
>
>       try:
> -       r = merge.graft(repo, orig, pctx, ['local', 'graft'], True)
> +       return merge.graft(repo, orig, pctx, ['local', 'graft'], True)
>       except TypeError:
>          # not using recent enough mercurial
>          if len(orig.parents()) == 2:
> @@ -3757,5 +3757,4 @@
>                  hint=_("Redo the merge and use `hg prune <old> --succ "
>                         "<new>` to obsolete the old one"))
>
> -       r = merge.graft(repo, orig, pctx, ['local', 'graft'])
> -    return r
> +       return merge.graft(repo, orig, pctx, ['local', 'graft'])
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -3748,7 +3748,7 @@ 
        repo.dirstate.setbranch(orig.branch())
 
     try:
-       r = merge.graft(repo, orig, pctx, ['local', 'graft'], True)
+       return merge.graft(repo, orig, pctx, ['local', 'graft'], True)
     except TypeError:
        # not using recent enough mercurial
        if len(orig.parents()) == 2:
@@ -3757,5 +3757,4 @@ 
                hint=_("Redo the merge and use `hg prune <old> --succ "
                       "<new>` to obsolete the old one"))
 
-       r = merge.graft(repo, orig, pctx, ['local', 'graft'])
-    return r
+       return merge.graft(repo, orig, pctx, ['local', 'graft'])