Patchwork [1,of,6,mergedriver] filemerge: clean up some dead code

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 12, 2015, 8:09 p.m.
Message ID <aa38606b117b5830b7f2.1444680577@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10972/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 12, 2015, 8:09 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1444601040 25200
#      Sun Oct 11 15:04:00 2015 -0700
# Node ID aa38606b117b5830b7f2521b7047405400f8e082
# Parent  e1162eb7f9b2942602b001ac24b141b3aa84c7e0
filemerge: clean up some dead code

We now exit early if we do a premerge, so extra checks are no longer necessary.
Siddharth Agarwal - Oct. 12, 2015, 8:13 p.m.
On 10/12/15 13:09, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1444601040 25200
> #      Sun Oct 11 15:04:00 2015 -0700
> # Node ID aa38606b117b5830b7f2521b7047405400f8e082
> # Parent  e1162eb7f9b2942602b001ac24b141b3aa84c7e0
> filemerge: clean up some dead code

For convenience, the entire series is also available as

hg pull http://42.netv6.net/sid0-wip/hg -r 1c951a14e427

>
> We now exit early if we do a premerge, so extra checks are no longer necessary.
>
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -522,12 +522,8 @@ def _filemerge(premerge, repo, mynode, o
>               # complete if premerge successful (r is 0)
>               return not r, r
>   
> -        if not r:  # premerge successfully merged the file
> -            needcheck = False
> -        else:
> -            needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
> -                                files, labels=labels)
> -
> +        needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, files,
> +                            labels=labels)
>           if needcheck:
>               r = _check(r, ui, tool, fcd, files)
>   
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -522,12 +522,8 @@  def _filemerge(premerge, repo, mynode, o
             # complete if premerge successful (r is 0)
             return not r, r
 
-        if not r:  # premerge successfully merged the file
-            needcheck = False
-        else:
-            needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
-                                files, labels=labels)
-
+        needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, files,
+                            labels=labels)
         if needcheck:
             r = _check(r, ui, tool, fcd, files)