Patchwork [3,of,5,V2] diff: draw a table about binary diff behaviors

login
register
mail settings
Submitter Jun Wu
Date May 6, 2017, 1:27 a.m.
Message ID <efded9da711f0c0fc129.1494034040@x1c>
Download mbox | patch
Permalink /patch/20466/
State Accepted
Headers show

Comments

Jun Wu - May 6, 2017, 1:27 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1494028138 25200
#      Fri May 05 16:48:58 2017 -0700
# Node ID efded9da711f0c0fc129f13577c6ce3789f1f183
# Parent  4f31a8ae3b30f6ca5fd8770a25b59f9638a48d6b
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r efded9da711f
diff: draw a table about binary diff behaviors

The table should make it easier to reason about future changes.

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2585,4 +2585,15 @@  def trydiff(repo, revs, ctx1, ctx2, modi
             header.append(diffline(path1, revs))
 
+        #  fctx.is  | diffopts                | what to   | is fctx.data()
+        #  binary() | text nobinary git index | output?   | outputted?
+        # ------------------------------------|----------------------------
+        #  yes      | no   no       no  *     | summary   | no
+        #  yes      | no   no       yes *     | base85    | yes
+        #  yes      | no   yes      no  *     | summary   | no
+        #  yes      | no   yes      yes 0     | summary   | no
+        #  yes      | no   yes      yes >0    | summary   | semi [1]
+        #  yes      | yes  *        *   *     | text diff | yes
+        #  no       | *    *        *   *     | text diff | yes
+        # [1]: hash(fctx.data()) is outputted. so fctx.data() cannot be faked
         if binary and opts.git and not opts.nobinary and not opts.text:
             text = mdiff.b85diff(content1, content2)