monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 77d61233ea3d61f0f97a8b6a01


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 77d61233ea3d61f0f97a8b6a0116c0c0d86c9ee6
Date: Sat, 27 Nov 2010 08:19:12 GMT

revision:            77d61233ea3d61f0f97a8b6a0116c0c0d86c9ee6
date:                2010-11-27T08:16:44
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
When removing a binary file, diff should report that said filename is
binary, not that /dev/null is.

For now, this is done by checking if filename2 is the magic marker '/dev/null'.

manifest:
format_version "1"

new_manifest [9243ca3e19406296d155b154e964b680ebb07b3b]

old_revision [f5726828ba2b388ea64db1e59f7319b79e98b75f]

add_dir "tests/filenames_in_diff_after_removal"

add_file "tests/filenames_in_diff_after_removal/__driver__.lua"
 content [02e3409da68a2c92695e31fb98b880028746c474]

add_file "tests/filenames_in_diff_after_removal/binary"
 content [08162783141d2b83def323d3039e0fc5902c7c1d]

patch "diff_output.cc"
 from [60b2a95586d371c1c67036f1e4e18cde917d3535]
   to [aeb8a9d42f608944af177b292651de8ba27ca7b4]
============================================================
--- diff_output.cc	60b2a95586d371c1c67036f1e4e18cde917d3535
+++ diff_output.cc	aeb8a9d42f608944af177b292651de8ba27ca7b4
@@ -475,7 +475,12 @@ make_diff(string const & filename1,
 {
   if (guess_binary(data1()) || guess_binary(data2()))
     {
-      ost << "# " << filename2 << " is binary\n";
+      // If a file has been removed, filename2 will be "/dev/null".
+      // It doesn't make sense to output that.
+      if (filename2 == "/dev/null")
+        ost << "# " << filename1 << " is binary\n";
+      else
+        ost << "# " << filename2 << " is binary\n";
       return;
     }
 
============================================================
--- /dev/null	
+++ tests/filenames_in_diff_after_removal/__driver__.lua	02e3409da68a2c92695e31fb98b880028746c474
@@ -0,0 +1,18 @@
+
+mtn_setup()
+
+-- If a binary file is removed, then 'mtn diff' should display:
+--   # binaryfilename is binary
+-- not:
+--   # /dev/null is binary
+
+check(get("binary"))
+
+check(mtn("add", "binary"), 0, false, false)
+commit()
+
+check(mtn("drop", "binary"), 0, false, false)
+check(not exists("binary"))
+check(mtn("diff"), 0, true, false)
+
+check(qgrep("# binary is binary", "stdout"))
============================================================
# tests/filenames_in_diff_after_removal/binary is binary

reply via email to

[Prev in Thread] Current Thread [Next in Thread]