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: c26b91d1884512efa7adf1b209


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: c26b91d1884512efa7adf1b209f207d142c03606
Date: Sat, 20 Nov 2010 01:08:54 GMT

revision:            c26b91d1884512efa7adf1b209f207d142c03606
date:                2010-11-20T01:07:14
author:              address@hidden
branch:              net.venge.monotone
changelog:
show_conflicts: output summary for non-automate

* NEWS: note change

* cmd_merging.cc (show_conflicts_core): output summary for non-automate
  (CMD store): output summary 

* merge_roster.hh: 
* merge_roster.cc (count_supported_resolution): new

* tests/resolve_conflicts_all_resolutions/__driver__.lua: 
* tests/resolve_conflicts_content/__driver__.lua: 
* tests/resolve_conflicts_duplicate_name/__driver__.lua: 
* tests/resolve_conflicts_duplicate_name_directory/__driver__.lua: 
* tests/resolve_conflicts_errors/__driver__.lua: 
* tests/resolve_conflicts_errors/conflicts-attr-store-1: 
* tests/resolve_conflicts_multiple_names/__driver__.lua: 
* tests/resolve_conflicts_none/__driver__.lua: 
* tests/resolve_conflicts_orphaned_file/__driver__.lua: 
* tests/resolve_conflicts_propagate/__driver__.lua: check summary

manifest:
format_version "1"

new_manifest [f9dedf0701a26a4a7bb6c94b7a140a55680698e5]

old_revision [0441b58e2b76c2aac899688f2feebc6ebd064268]

patch "NEWS"
 from [ec286f4ed73bd85c42a5e9cb4ff76d6f0141fca3]
   to [c2462806108dfa614009252583ddf883720be681]

patch "cmd_merging.cc"
 from [66c3882326a06d0abf878905bb515de80cc9e905]
   to [d5f35495dd5c6d7f1749c043ec84d8577519252b]

patch "merge_roster.cc"
 from [9c8e34b5521bde6f9a38f2996ce0edf51273e98d]
   to [395bb5836bc21de80a7b3e6dafd48927faf24f16]

patch "merge_roster.hh"
 from [ec7922c9e6b39c157f7ac5b1504090d88bf6b728]
   to [cd2da3b06f595187a27622a98580b0636aabea4b]

patch "tests/resolve_conflicts_all_resolutions/__driver__.lua"
 from [f4dd26eefb2947afd411ab32f16146407ef5883f]
   to [0a504a8ecd385dadb9a01b7fc2c836e58dbaf6ff]

patch "tests/resolve_conflicts_content/__driver__.lua"
 from [5177f9cdbaf41359eac0306e3814b074c8eb2d06]
   to [00570ab4eeccfc248746cca7ffada958461d4102]

patch "tests/resolve_conflicts_duplicate_name/__driver__.lua"
 from [ad7475c98789724de1a8cfdb4fc3bafb440c9a60]
   to [5d6f43fe7428cb0d7843e43d74004ab9eacad7b2]

patch "tests/resolve_conflicts_duplicate_name_directory/__driver__.lua"
 from [c99e91400983a126bcf49990f932bf6139b7a49a]
   to [66f49383b58f91df46e01e08536435bf0e26aa5d]

patch "tests/resolve_conflicts_errors/__driver__.lua"
 from [216683714aca7ef676ff4762a752305134378340]
   to [8c27319a9b511c25b97e2cac91d0e584423583c3]

patch "tests/resolve_conflicts_errors/conflicts-attr-store-1"
 from [1246f7f1f61862561d92b9a5b8b9b7e006b690ac]
   to [12ae8349e961afe2b9a38bfe226bd7362559e6e9]

patch "tests/resolve_conflicts_multiple_names/__driver__.lua"
 from [fbeef82db6e4c188e405f6624557a7979cc8304f]
   to [399ec0773cc1511e7df5b20634a6651b45c48d0f]

patch "tests/resolve_conflicts_none/__driver__.lua"
 from [2562feb882bb09193c928f52630e105475ac5759]
   to [c65be50e01bf384510ef44202889c3ec0225bd52]

patch "tests/resolve_conflicts_orphaned_file/__driver__.lua"
 from [ca1edc44c3348a1336c503e104ca849654020f3b]
   to [fd4271398f08816fb75402094c5320bbd57b2616]

patch "tests/resolve_conflicts_propagate/__driver__.lua"
 from [1033fef4df9f5fc271562bab64d0096aa8e578aa]
   to [cab69397238b8c68a99074045c42a481972c3da1]
============================================================
--- NEWS	ec286f4ed73bd85c42a5e9cb4ff76d6f0141fca3
+++ NEWS	c2462806108dfa614009252583ddf883720be681
@@ -10,6 +10,10 @@ XXX XXX XX XX:XX:XX UTC 2010
 
         New Features
 
+        - 'mtn conflicts store' now outputs a count of the conflicts,
+          and the name of the conflicts file. Fixes monotone issue
+          108.
+        
         Bugs fixed
 
         - improve help, fix arg indexing in 'conflicts resolve_first'
============================================================
--- merge_roster.cc	9c8e34b5521bde6f9a38f2996ce0edf51273e98d
+++ merge_roster.cc	395bb5836bc21de80a7b3e6dafd48927faf24f16
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 Stephen Leake <address@hidden>
+// Copyright (C) 2008, 2010 Stephen Leake <address@hidden>
 //               2005 Nathaniel Smith <address@hidden>
 //
 // This program is made available under the GNU GPL version 2.0 or
@@ -180,6 +180,14 @@ int
 }
 
 int
+roster_merge_result::count_supported_resolution() const
+{
+  return orphaned_node_conflicts.size()
+    + file_content_conflicts.size()
+    + duplicate_name_conflicts.size();
+}
+
+int
 roster_merge_result::count_unsupported_resolution() const
 {
   return (missing_root_conflict ? 1 : 0)
============================================================
--- merge_roster.hh	ec7922c9e6b39c157f7ac5b1504090d88bf6b728
+++ merge_roster.hh	cd2da3b06f595187a27622a98580b0636aabea4b
@@ -1,4 +1,4 @@
-// Copyright (C) 2005 Nathaniel Smith <address@hidden>
+// Copyright (C) 2005, 2010 Nathaniel Smith <address@hidden>
 //               2008, 2009 Stephen Leake <address@hidden>
 //
 // This program is made available under the GNU GPL version 2.0 or
@@ -187,6 +187,7 @@ struct roster_merge_result
   bool is_clean() const;
   bool has_content_conflicts() const;
   bool has_non_content_conflicts() const;
+  int  count_supported_resolution() const;
   int  count_unsupported_resolution() const;
   void log_conflicts() const;
 
============================================================
--- cmd_merging.cc	66c3882326a06d0abf878905bb515de80cc9e905
+++ cmd_merging.cc	d5f35495dd5c6d7f1749c043ec84d8577519252b
@@ -966,7 +966,7 @@ show_conflicts_core (database & db,
                      revision_id const & l_id,
                      revision_id const & r_id,
                      bool const basic_io,
-                     bool warn_unsupported,
+                     bool automate,
                      std::ostream & output)
 {
   // Note that left and right are in the order specified on the command line.
@@ -1037,8 +1037,9 @@ show_conflicts_core (database & db,
           pr.print_stanza(st);
           output.write(pr.buf.data(), pr.buf.size());
         }
-      else
-        P(F("no conflicts detected"));
+
+      if (!automate)
+        P(F("0 conflicts"));
     }
   else
     {
@@ -1068,13 +1069,19 @@ show_conflicts_core (database & db,
       result.report_attribute_conflicts(*l_roster, *r_roster, adaptor, basic_io, output);
       result.report_file_content_conflicts(lua, *l_roster, *r_roster, adaptor, basic_io, output);
 
-      if (warn_unsupported)
+      if (!automate)
         {
-          int const count = result.count_unsupported_resolution();
-          if (count > 0)
+          int const supported = result.count_supported_resolution();
+          int const unsupported = result.count_unsupported_resolution();
+
+          P(FP("%d conflict with supported resolutions.",
+               "%d conflicts with supported resolutions.",
+               supported) % supported);
+
+          if (unsupported > 0)
             P(FP("warning: %d conflict with no supported resolutions.",
                  "warning: %d conflicts with no supported resolutions.",
-                 count) % count);
+                 unsupported) % unsupported);
         }
     }
 }
@@ -1094,7 +1101,10 @@ CMD(show_conflicts, "show_conflicts", ""
   complete(app.opts, app.lua, project, idx(args,0)(), l_id);
   complete(app.opts, app.lua, project, idx(args,1)(), r_id);
 
-  show_conflicts_core(db, app.lua, l_id, r_id, false, false, std::cout);
+  show_conflicts_core(db, app.lua, l_id, r_id,
+                      false, // basic_io
+                      false, // automate
+                      std::cout);
 }
 
 static void get_conflicts_rids(args_vector const & args,
@@ -1159,7 +1169,10 @@ CMD_AUTOMATE(show_conflicts, N_("[LEFT_R
   revision_id l_id, r_id;
 
   get_conflicts_rids(args, db, project, app, l_id, r_id);
-  show_conflicts_core(db, app.lua, l_id, r_id, true, false, output);
+  show_conflicts_core(db, app.lua, l_id, r_id,
+                      true, // basic_io
+                      true, // automate
+                      output);
 }
 
 CMD(store, "store", "", CMD_REF(conflicts),
@@ -1179,10 +1192,14 @@ CMD(store, "store", "", CMD_REF(conflict
   get_conflicts_rids(args, db, project, app, left_id, right_id);
 
   std::ostringstream output;
-  show_conflicts_core(db, app.lua, left_id, right_id, true, true, output);
+  show_conflicts_core(db, app.lua, left_id, right_id,
+                      true, // basic_io
+                      false, // automate
+                      output);
 
   data dat(output.str(), origin::internal);
   write_data(app.opts.conflicts_file, dat);
+  P(F("stored in '%s'") % app.opts.conflicts_file);
 }
 
 CMD_AUTOMATE(file_merge, N_("LEFT_REVID LEFT_FILENAME RIGHT_REVID RIGHT_FILENAME"),
============================================================
--- tests/resolve_conflicts_duplicate_name/__driver__.lua	ad7475c98789724de1a8cfdb4fc3bafb440c9a60
+++ tests/resolve_conflicts_duplicate_name/__driver__.lua	5d6f43fe7428cb0d7843e43d74004ab9eacad7b2
@@ -44,7 +44,9 @@ check(mtn("merge"), 1, nil, false)
 -- For thermostat.c, she specifies a conflict resolution that renames
 -- both versions.
 
-check(mtn("conflicts", "store"), 0, true, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 check(samefilestd("conflicts-1", "_MTN/conflicts"))
 
 -- Find out what the first unresolved conflict is
============================================================
--- tests/resolve_conflicts_content/__driver__.lua	5177f9cdbaf41359eac0306e3814b074c8eb2d06
+++ tests/resolve_conflicts_content/__driver__.lua	00570ab4eeccfc248746cca7ffada958461d4102
@@ -36,7 +36,10 @@ second = base_revision()
 
 -- We specify 'first second' so the left/right don't change as when we
 -- make small changes to the test (default order is alphabetical rev id).
-check(indir("files", mtn("conflicts", "store", first, second)), 0, nil, nil)
+check(indir("files", mtn("conflicts", "store", first, second)), 0, nil, true)
+check(samelines("stderr",
+{"mtn: 5 conflicts with supported resolutions.",
+ "mtn: stored in '_MTN/conflicts'"}))
 check(samefilestd("conflicts-1", "_MTN/conflicts"))
 
 -- invalid resolution identifier
============================================================
--- tests/resolve_conflicts_all_resolutions/__driver__.lua	f4dd26eefb2947afd411ab32f16146407ef5883f
+++ tests/resolve_conflicts_all_resolutions/__driver__.lua	0a504a8ecd385dadb9a01b7fc2c836e58dbaf6ff
@@ -63,7 +63,9 @@ mkdir("resolutions")
 
 -- Test non-default conflicts file name
 mkdir("resolutions")
-check (mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "store", abe_1, beth_1), 0, nil, nil)
+check (mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "store", abe_1, beth_1), 0, nil, true)
+check(samelines("stderr", {"mtn: 8 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts-1'"}))
 check(samefilestd("conflicts-1", "_MTN/conflicts-1"))
 
 check(mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "show_remaining"), 0, nil, true)
@@ -120,7 +122,7 @@ mkdir("_MTN/resolutions")
 check(samefilestd("show_first-interactive", "stderr"))
 
 mkdir("_MTN/resolutions")
-check(mtn("--rcfile=merge3_hook.lua", "conflicts", "--conflicts-file=_MTN/conflicts-1", "resolve_first", "interactive", "_MTN/resolutions/interactive_file"), 0, true, true)
+check(mtn("--rcfile=merge3_hook.lua", "conflicts", "--conflicts-file=_MTN/conflicts-1", "resolve_first", "interactive", "_MTN/resolutions/interactive_file"), 0, nil, true)
 check(samelines("stderr", { "mtn: lua: running merge3 hook",
                             "mtn: interactive merge result saved in '_MTN/resolutions/interactive_file'"}))
 
============================================================
--- tests/resolve_conflicts_errors/__driver__.lua	216683714aca7ef676ff4762a752305134378340
+++ tests/resolve_conflicts_errors/__driver__.lua	8c27319a9b511c25b97e2cac91d0e584423583c3
@@ -22,6 +22,7 @@ check(mtn("conflicts", "store", left_1, 
 check(mtn("conflicts", "store", left_1), 1, nil, true)
 check(mtn("conflicts", "store", left_1, right_1, right_1), 1, nil, true)
 
+-- success
 check(mtn("conflicts", "store", left_1, right_1), 0, nil, true)
 canonicalize("stderr")
 check(samefilestd("conflicts-attr-store-1", "stderr"))
@@ -72,7 +73,9 @@ commit("testbranch", "left 2")
 addfile("checkout.sh", "checkout.sh left 1")
 commit("testbranch", "left 2")
 
-check(mtn("conflicts", "store"), 0, true, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 
 -- invalid number of params
 check(mtn("conflicts", "resolve_first_left", "user"), 1, nil, true)
============================================================
--- tests/resolve_conflicts_errors/conflicts-attr-store-1	1246f7f1f61862561d92b9a5b8b9b7e006b690ac
+++ tests/resolve_conflicts_errors/conflicts-attr-store-1	12ae8349e961afe2b9a38bfe226bd7362559e6e9
@@ -1 +1,3 @@
+mtn: 0 conflicts with supported resolutions.
 mtn: warning: 1 conflict with no supported resolutions.
+mtn: stored in '_MTN/conflicts'
============================================================
--- tests/resolve_conflicts_none/__driver__.lua	2562feb882bb09193c928f52630e105475ac5759
+++ tests/resolve_conflicts_none/__driver__.lua	c65be50e01bf384510ef44202889c3ec0225bd52
@@ -20,7 +20,9 @@ second = base_revision()
 commit("testbranch", "second")
 second = base_revision()
 
-check(mtn("conflicts", "store"), 0, nil, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 0 conflicts",
+                           "mtn: stored in '_MTN/conflicts'"}))
 check(samefilestd("conflicts-1", "_MTN/conflicts"))
 
 check(mtn("conflicts", "show_first"), 0, nil, true)
============================================================
--- tests/resolve_conflicts_propagate/__driver__.lua	1033fef4df9f5fc271562bab64d0096aa8e578aa
+++ tests/resolve_conflicts_propagate/__driver__.lua	cab69397238b8c68a99074045c42a481972c3da1
@@ -30,7 +30,9 @@ beth_1 = base_revision()
 
 -- Propagate abe_branch to beth_branch
 
-check(mtn("conflicts", "store", abe_1, beth_1), 0, true, nil)
+check(mtn("conflicts", "store", abe_1, beth_1), 0, nil, true)
+check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 check(samefilestd("conflicts-1", "_MTN/conflicts"))
 
 check(mtn("conflicts", "resolve_first_left", "drop"), 0, nil, nil)
@@ -63,7 +65,9 @@ check(samefilestd("conflicts-2", "stdout
 canonicalize("stdout")
 check(samefilestd("conflicts-2", "stdout"))
 
-check(mtn("conflicts", "store",  beth_1, abe_1), 0, nil, nil)
+check(mtn("conflicts", "store",  beth_1, abe_1), 0, nil, true)
+check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 check(samefilestd("conflicts-2", "_MTN/conflicts"))
 
 check(mtn("propagate", "beth_branch", "abe_branch"), 0, nil, true)
============================================================
--- tests/resolve_conflicts_multiple_names/__driver__.lua	fbeef82db6e4c188e405f6624557a7979cc8304f
+++ tests/resolve_conflicts_multiple_names/__driver__.lua	399ec0773cc1511e7df5b20634a6651b45c48d0f
@@ -25,8 +25,8 @@ check(mtn("conflicts", "store"), 0, nil,
 right_1 = base_revision()
 
 check(mtn("conflicts", "store"), 0, nil, true)
-canonicalize("stderr")
-check("mtn: warning: 1 conflict with no supported resolutions.\n" == readfile("stderr"))
+check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
+                           "mtn: warning: 1 conflict with no supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 
--- mtn("conflicts", "show_first")
 -- end of file
============================================================
--- tests/resolve_conflicts_orphaned_file/__driver__.lua	ca1edc44c3348a1336c503e104ca849654020f3b
+++ tests/resolve_conflicts_orphaned_file/__driver__.lua	fd4271398f08816fb75402094c5320bbd57b2616
@@ -26,16 +26,16 @@ left_1 = base_revision()
 commit("testbranch", "left 1")
 left_1 = base_revision()
 
-check(mtn("conflicts", "store"), 0, nil, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 5 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 
 -- Check suggested resolutions for orphaned directory
 check(mtn("conflicts", "show_first"), 0, nil, true)
-canonicalize("stderr")
-check(
-"mtn: orphaned node stuff/dir1\n" ..
-"mtn: possible resolutions:\n" ..
-"mtn: resolve_first drop\n" ..
-"mtn: resolve_first rename \"file_name\"\n" == readfile("stderr"))
+check(samelines("stderr", {"mtn: orphaned node stuff/dir1",
+                           "mtn: possible resolutions:",
+                           "mtn: resolve_first drop",
+                           "mtn: resolve_first rename \"file_name\""}))
 
 -- invalid resolution identifier
 check(mtn("conflicts", "resolve_first", "foo"), 1, nil, true)
@@ -79,7 +79,9 @@ right_2 = base_revision()
 right_2 = base_revision()
 
 --  and now we start the resolution process over again
-check(mtn("conflicts", "store"), 0, nil, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 5 conflicts with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 check(mtn("conflicts", "show_first"), 0, nil, true)
 check(qgrep("orphaned node stuff/dir1", "stderr"));
 check(mtn("conflicts", "resolve_first", "rename", "dir1"), 0, nil, nil)
============================================================
--- tests/resolve_conflicts_duplicate_name_directory/__driver__.lua	c99e91400983a126bcf49990f932bf6139b7a49a
+++ tests/resolve_conflicts_duplicate_name_directory/__driver__.lua	66f49383b58f91df46e01e08536435bf0e26aa5d
@@ -25,7 +25,9 @@ beth_1 = base_revision()
 beth_1 = base_revision()
 
 -- Resolve conflict
-check(mtn("conflicts", "store"), 0, true, nil)
+check(mtn("conflicts", "store"), 0, false, true)
+check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 
 check(mtn("conflicts", "show_first"), 0, nil, true)
 check(qgrep("duplicate_name gui", "stderr"))
@@ -40,7 +42,9 @@ check(mtn("conflicts", "clean"), 0, nil,
 -- Start again, use renames for both sides
 check(mtn("conflicts", "clean"), 0, nil, true)
 
-check(mtn("conflicts", "store"), 0, true, nil)
+check(mtn("conflicts", "store"), 0, nil, true)
+check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
+                           "mtn: stored in '_MTN/conflicts'"}))
 
 check(mtn("conflicts", "show_first"), 0, nil, true)
 check(qgrep("duplicate_name gui", "stderr"))

reply via email to

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