compat: backed out changeset cfcb7eedc666 stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 23 Apr 2019 12:20:12 +0200
branchstable
changeset 4554 093df66127ec
parent 4546 e7b44e9c38d2
child 4555 e914abb05c6a
child 4556 b5186fe43c7c
child 4564 a1072c2910c2
compat: backed out changeset cfcb7eedc666 That changesets breaks 4.4 compat. We will reinstall it for the next version.
CHANGELOG
hgext3rd/evolve/evolvecmd.py
--- a/CHANGELOG	Fri Apr 19 10:31:53 2019 +0530
+++ b/CHANGELOG	Tue Apr 23 12:20:12 2019 +0200
@@ -5,6 +5,8 @@
 -------------------
 
   * evolve: make sure we use upstream merge code with 5.0,
+  * evolve: restore compatibility with 4.4
+            (This regress the narrow compatibility)
   * topic: compatibility with mercurial-5.0,
   * topic: improve extensions isolation (issue6121).
 
--- a/hgext3rd/evolve/evolvecmd.py	Fri Apr 19 10:31:53 2019 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 23 12:20:12 2019 +0200
@@ -276,22 +276,43 @@
     newid = None
     replacementnode = None
 
-    # Create the new commit context. This is done by applying the changes from
-    # the precursor to the bumped node onto the precursor. This is effectively
-    # like reverting to the bumped node.
-    wctx = context.overlayworkingctx(repo)
-    wctx.setbase(prec)
-    merge.update(repo, bumped.node(), ancestor=prec, mergeancestor=True,
-                 branchmerge=True, force=False, wc=wctx)
-    if not wctx.isempty():
+    # Create the new commit context
+    files = set()
+    copied = copies.pathcopies(prec, bumped)
+    precmanifest = prec.manifest().copy()
+    # 3.3.2 needs a list.
+    # future 3.4 don't detect the size change during iteration
+    # this is fishy
+    for key, val in list(bumped.manifest().iteritems()):
+        precvalue = precmanifest.get(key, None)
+        if precvalue is not None:
+            del precmanifest[key]
+        if precvalue != val:
+            files.add(key)
+    files.update(precmanifest)  # add missing files
+
+    # commit it
+    if files: # something to commit!
+        def filectxfn(repo, ctx, path):
+            if path in bumped:
+                fctx = bumped[path]
+                flags = fctx.flags()
+                mctx = compat.memfilectx(repo, ctx, fctx, flags, copied, path)
+                return mctx
+            return None
         text = '%s update to %s:\n\n' % (TROUBLES['PHASEDIVERGENT'], prec)
         text += bumped.description()
-        memctx = wctx.tomemctx(text,
-                               parents=(prec.node(), nodemod.nullid),
-                               date=bumped.date(),
-                               extra=bumped.extra(),
-                               user=bumped.user())
-        newid = repo.commitctx(memctx)
+
+        new = context.memctx(repo,
+                             parents=[prec.node(), nodemod.nullid],
+                             text=text,
+                             files=files,
+                             filectxfn=filectxfn,
+                             user=bumped.user(),
+                             date=bumped.date(),
+                             extra=bumped.extra())
+
+        newid = repo.commitctx(new)
         replacementnode = newid
     if newid is None:
         repo.ui.status(_('no changes to commit\n'))