Patchwork [4,of,4] diff: use `context.diff` to produce diff

login
register
mail settings
Submitter Boris Feld
Date May 24, 2018, 8:38 a.m.
Message ID <7f96a8be51519fb345cb.1527151137@FB>
Download mbox | patch
Permalink /patch/31830/
State New
Headers show

Comments

Boris Feld - May 24, 2018, 8:38 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1527082304 -7200
#      Wed May 23 15:31:44 2018 +0200
# Node ID 7f96a8be51519fb345cb6a659ae7615f695ec766
# Parent  d76075d78a860ea2b3e01f3c05969cd0b8839f35
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7f96a8be5151
diff: use `context.diff` to produce diff

We want to make sure `context.diff` if full featured. Using it in the main

Patch

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