[PATCH evolve-ext] compat: don't monkeypatch mercurial.copies module on 4.8

Augie Fackler raf at durin42.com
Fri Nov 2 00:58:34 UTC 2018


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1541117853 14400
#      Thu Nov 01 20:17:33 2018 -0400
# Node ID 1103851bda846b952659a50aaff4e20d34e62a40
# Parent  a4d5dcc836ab287b08aa6591ee8b25bff9028042
compat: don't monkeypatch mercurial.copies module on 4.8

The backport was frozen in time sometime before important
narrow-related improvements to this module. Rather than try to make
the monkeypatch more up to date, let's just not use it where we know
it won't be needed.

diff --git a/hgext3rd/evolve/compat.py b/hgext3rd/evolve/compat.py
--- a/hgext3rd/evolve/compat.py
+++ b/hgext3rd/evolve/compat.py
@@ -698,10 +698,13 @@ def fixoldmergecopies(repo, c1, c2, base
                     break
 
     return copy, movewithdir, diverge, renamedelete, dirmove
+# sniff for stringutil on copies as a way to detect hg 4.8 and *not*
+# patch copytracing there, as our backport breaks the narrow extension.
+_ishg48 = util.safehasattr(copies, 'stringutil')
 
-if util.safehasattr(copies, '_fullcopytracing'):
+if util.safehasattr(copies, '_fullcopytracing') and not _ishg48:
     copies._fullcopytracing = fixedcopytracing
-elif util.safehasattr(copies, 'mergecopies'):
+elif util.safehasattr(copies, 'mergecopies') and not _ishg48:
     # compat fix for hg <= 4.3
     copies.mergecopies = fixoldmergecopies
 


More information about the Mercurial-devel mailing list