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

login
register
mail settings
Submitter Augie Fackler
Date Nov. 2, 2018, 12:58 a.m.
Message ID <1103851bda846b952659.1541120314@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/36320/
State New
Headers show

Comments

Augie Fackler - Nov. 2, 2018, 12:58 a.m.
# HG changeset patch
# User Augie Fackler <augie@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.

Patch

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