[PATCH] Remove unused code in pure/mpatch.py

Andrey Somov py4fun at gmail.com
Wed Oct 19 02:58:21 CDT 2011


# HG changeset patch
# User py4fun
# Date 1318884259 -7200
# Node ID dae3dbb444055486db76e376b65972c86bf1d1b2
# Parent  d4addef0ec74370fbf75b138d06f8ad93d3038ff
Remove unused code in pure/mpatch.py

'tl' variable can only be empty when 'a' is empty and 'bin' is a non-empty list of empty fragments.
This case is still managed properly and the check is not required. Since the check is run always, it is more
efficient to remove the check. In rare cases of empty fragments (if ever) the peroper result will be
generated anyway

diff -r d4addef0ec74 -r dae3dbb44405 mercurial/pure/mpatch.py
--- a/mercurial/pure/mpatch.py	Mon Oct 17 00:11:56 2011 +0200
+++ b/mercurial/pure/mpatch.py	Mon Oct 17 22:44:19 2011 +0200
@@ -31,9 +31,6 @@
     tl = bl + bl + pl # enough for the patches and two working texts
     b1, b2 = 0, bl
 
-    if not tl:
-        return a
-
     m = StringIO()
     def move(dest, src, count):
         """move count bytes from src to dest


More information about the Mercurial-devel mailing list