diff: draw a table about binary diff behaviors
authorJun Wu <quark@fb.com>
Fri, 05 May 2017 16:48:58 -0700
changeset 32189 15f10ee778f8
parent 32188 776127b29a5c
child 32190 0c67ab3d77d5
diff: draw a table about binary diff behaviors The table should make it easier to reason about future changes.
mercurial/patch.py
--- a/mercurial/patch.py	Wed May 03 22:20:44 2017 -0700
+++ b/mercurial/patch.py	Fri May 05 16:48:58 2017 -0700
@@ -2584,6 +2584,17 @@
         elif revs and not repo.ui.quiet:
             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)
             if text: