[PATCH 9 of 9 V2] diff: use `context.diff` to produce diff

Boris Feld boris.feld at octobus.net
Thu Jul 5 22:26:07 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1527082304 -7200
#      Wed May 23 15:31:44 2018 +0200
# Node ID 53f23ec9115d4e28111ad0271e21719b58c59119
# Parent  8bef75984a9d9887b500c567d2da3da196f49761
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 53f23ec9115d
diff: use `context.diff` to produce diff

We want to make sure `context.diff` if full featured. Using it in the main
diff code path is a good way to do so.

The end goal is to be able to easily compute diff between in-memory context.

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -76,9 +76,9 @@ def diffordiffstat(ui, repo, diffopts, n
         if not ui.plain():
             width = ui.termwidth()
 
-    chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
-                        prefix=prefix, relroot=relroot,
-                        hunksfilterfn=hunksfilterfn)
+    chunks = repo[node2].diff(repo[node1], match, changes, opts=diffopts,
+                              prefix=prefix, relroot=relroot,
+                              hunksfilterfn=hunksfilterfn)
 
     if fp is not None or ui.canwritewithoutlabels():
         out = fp or ui



More information about the Mercurial-devel mailing list