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.issue-209.file_attribute: fc


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.issue-209.file_attribute: fc8be5f8894e0e0160f475b0cf463180649926db
Date: Thu, 21 Jun 2012 14:29:32 +0200 (CEST)

revision:            fc8be5f8894e0e0160f475b0cf463180649926db
date:                2012-06-21T12:27:09
author:              address@hidden
branch:              net.venge.monotone.issue-209.file_attribute
changelog:
require --resolve_conflicts even for mtn:resolve_conflicts, doc attribute

* NEWS: report new mtn:resolve_conflict attribute

* doc/monotone.texi (Merge Conflicts): doc new mtn:resolve_conflict attribute

* src/merge_conflict.cc
  (report_dropped_modified_conflicts): report resolution in non-basic-io
  (parse_resolve_conflicts_opts): allow no _MTN/conflicts

* src/merge_content.cc (resolve_merge_conflicts): require --resolve_conflicts 
even for mtn:resolve_conflicts

* 
test/func/resolve_conflicts_dropped_modified_upstream_vs_local/__driver__.lua: 
match changes.


manifest:
format_version "1"

new_manifest [d5695b9a07f0b4e1d1289d67d3f3420aa996a639]

old_revision [22d58504a5b2f1ae30a72a8365b394b4f44c34cd]

patch "NEWS"
 from [14720ed190f83297dba3fe3fc434145a26215280]
   to [bcbf710c9e118a148d777b42c0744ba89207a6a6]

patch "doc/monotone.texi"
 from [0e142e05cc32b30995f845436ee7463dabdc279c]
   to [45b26a16e3411a896b0c99e84c3e21842cfa9368]

patch "src/merge_conflict.cc"
 from [bfe541054099570c84dec211c6ed9980ec2bf43f]
   to [9e1f37fb81b2d1ba5f9553f5bf171e784e86ad5a]

patch "src/merge_content.cc"
 from [3cc3b3f391b7ac369cd6f9ef7afb364178b4fe35]
   to [f29f3cabcacd554b53f6f273c3df3ca3ceec7a49]

patch 
"test/func/resolve_conflicts_dropped_modified_upstream_vs_local/__driver__.lua"
 from [7c8b929f332343bb26a5fb489727ec53e5bd60bc]
   to [d582ad7875b4a98b2a0c60e05b7cfeaa80187f5a]
============================================================
--- NEWS	14720ed190f83297dba3fe3fc434145a26215280
+++ NEWS	bcbf710c9e118a148d777b42c0744ba89207a6a6
@@ -31,6 +31,13 @@ XXX XXX XX XX:XX:XX UTC 201X
           were always lost; now you have the option of re-adding the
           file with the modifications during merge conflict
           resolution.
+
+        - New attribute 'mtn:resolve_conflict' allows specifying a
+          persistent 'drop' conflict resolution for a dropped/modified
+          conflict. This is useful in the case where the conflict will
+          occur again in the future, for example when a file that is
+          maintained in an upstream branch is not needed, and
+          therefore dropped, in a local branch.
         
         Bugs fixed
 
============================================================
--- doc/monotone.texi	0e142e05cc32b30995f845436ee7463dabdc279c
+++ doc/monotone.texi	45b26a16e3411a896b0c99e84c3e21842cfa9368
@@ -3495,6 +3495,20 @@ @subheading Dropped/Modified file Confli
 resolutions are to drop the file in the result, keep the modified
 version, or keep a user supplied version.
 
+In addition, the attribute @command{mtn:resolve_conflict} may be used
+to specify a @command{drop} resolution for this
+conflict. @command{--resolve_conflict} must be specified on the merge
+command for the attribute to be processed. Note that a
address@hidden/conflicts} file left over from a previous merge will be
+processed when @command{--resolve_conflict}; the user must delete such
+files when they are no longer needed.
+
+The attribute is useful in the case
+where the conflict will occur again in the future, for example when a
+file that is maintained in an upstream branch is not needed, and
+therefore dropped, in a local branch. The user only needs to specify
+the conflict resolution once, via the attribute.
+
 Because of the @emph{die-die-die} policy, monotone internally must
 first drop the modified file, and then add a new file with the same
 name and the desired contents. This means history is disconnected;
@@ -4994,7 +5008,7 @@ @section Tree
 to be the given revision or the head of the given branch instead of the
 null revision.
 
address@hidden address@hidden mtn merge address@hidden [--message @var{string}] [--message-file @var{filename}] [--[no-]update]
address@hidden address@hidden mtn merge address@hidden [--message @var{string}] [--message-file @var{filename}] [--[no-]update] [--resolve-conflicts]
 See the online help for more options. See @ref{--update}.
 
 This command merges the ``heads'' of @var{branchname} (default the
@@ -5014,7 +5028,8 @@ @section Tree
 algorithm. The process then repeats for each additional head, using
 the result of each previous merge as an input to the next.
 
address@hidden Conflicts} can occur.
address@hidden Conflicts} for conflicts that can occur, and the use of
address@hidden
 
 @item mtn merge_into_dir [--[no-]update] @var{sourcebranch} @var{destbranch} @var{dir}
 This command takes a unique head from @var{sourcebranch} and merges it
============================================================
--- src/merge_conflict.cc	bfe541054099570c84dec211c6ed9980ec2bf43f
+++ src/merge_conflict.cc	9e1f37fb81b2d1ba5f9553f5bf171e784e86ad5a
@@ -1256,6 +1256,38 @@ roster_merge_result::report_dropped_modi
                     P(F("dropped and recreated on the right"));
                 }
             }
+
+          // We can have a resolution from a mtn:resolve_conflict attribute.
+          switch (conflict.resolution.first)
+            {
+            case resolve_conflicts::none:
+              break;
+
+            case resolve_conflicts::content_user:
+              P(F("resolution: user file '%s'") % conflict.resolution.second->as_external());
+              break;
+
+            case resolve_conflicts::content_user_rename:
+              P(F("resolution: user '%s' rename '%s'") %
+                conflict.resolution.second->as_external() %
+                conflict.rename.as_external());
+              break;
+
+            case resolve_conflicts::rename:
+              P(F("resolution: rename '%s'") % conflict.resolution.second->as_external());
+              break;
+
+            case resolve_conflicts::drop:
+              P(F("resolution: drop"));
+              break;
+
+            case resolve_conflicts::keep:
+              P(F("resolution: keep"));
+              break;
+
+            default:
+              I(false);
+            }
         }
     }
 }
@@ -2628,6 +2660,13 @@ parse_resolve_conflicts_opts (options co
     {
       resolutions_given = true;
 
+      if (!file_exists(system_path(opts.resolve_conflicts_file)))
+        {
+          // user may specify --resolve_conflicts to enable attr
+          // mtn:resolve_conflict, without _MTN/conflicts.
+          return;
+        }
+
       data dat;
 
       read_data (system_path(opts.resolve_conflicts_file), dat);
============================================================
--- src/merge_content.cc	3cc3b3f391b7ac369cd6f9ef7afb364178b4fe35
+++ src/merge_content.cc	f29f3cabcacd554b53f6f273c3df3ca3ceec7a49
@@ -724,6 +724,9 @@ resolve_merge_conflicts(lua_hooks & lua,
 
       if (resolutions_given)
         {
+          // We require --resolve_conflicts to enable processing attr
+          // mtn:resolve_conflict.
+
           // If there are any conflicts for which we don't currently support
           // resolutions, give a nice error message.
           char const * const msg = "conflict resolution for %s not yet supported";
@@ -747,13 +750,6 @@ resolve_merge_conflicts(lua_hooks & lua,
 
           result.resolve_file_content_conflicts (lua, left_roster, right_roster, adaptor);
         }
-      else
-        {
-          // The user did not specify --resolve_conflicts, but there may
-          // still be some specified by attr mtn:resolve_conflict. Only
-          // these conflicts support that so far.
-          result.resolve_dropped_modified_conflicts(lua, left_roster, right_roster, adaptor, nis);
-        }
     }
 
   if (result.has_non_content_conflicts())
============================================================
--- test/func/resolve_conflicts_dropped_modified_upstream_vs_local/__driver__.lua	7c8b929f332343bb26a5fb489727ec53e5bd60bc
+++ test/func/resolve_conflicts_dropped_modified_upstream_vs_local/__driver__.lua	d582ad7875b4a98b2a0c60e05b7cfeaa80187f5a
@@ -70,15 +70,19 @@ upstream_2 = base_revision()
 
 -- Since the attribute specifies the conflict resolution, we don't need to specify one ourselves
 
--- We do not require --resolve-conflicts here; the attribute use makes
--- the conflict transparent.
-check(mtn("merge"), 0, nil, true)
+-- We require --resolve-conflicts here, mostly for consistency with
+-- 1.0 behavior (where resolving non-content conflicts requires
+-- --resolve-conflict)
+check(mtn("merge"), 1, nil, true)
+check(qgrep("mtn: misuse: merge failed due to unresolved conflicts", "stderr"))
+
+check(mtn("merge", "--resolve-conflicts"), 0, nil, true)
 check(qgrep("mtn: dropping 'file_2'", "stderr"))
 
 check(mtn("update"), 0, nil, true)
 check(not exists("file_2"))
 
--- FIXME: show attribute here, report no unresolved conflicts, allow merge
+-- Show that 'show_conflicts' reports the attribute resolution properly.
 check(mtn("show_conflicts", upstream_2, local_2), 0, nil, true)
 check(samelines
 ("stderr",
@@ -88,10 +92,12 @@ check(samelines
   "mtn: conflict: file 'file_2' from revision 1e700864de7a2cbb1cf85c26f5e1e4ca335d2bc2",
   "mtn: modified on the left, named file_2",
   "mtn: dropped on the right",
+  "mtn: resolution: drop",
   "mtn: 1 conflict with supported resolutions."}))
 
 -- 'conflicts store' is not needed unless there are other conflicts,
--- or the user wants to override the attribute.
+-- or the user wants to override the attribute. Show that it reports
+-- the attr resolution properly.
 check(mtn("conflicts", "store", upstream_2, local_2), 0, nil, true)
 check(samefilestd("conflicts", "_MTN/conflicts"))
 

reply via email to

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