monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] Workspace merge?


From: Stephen Leake
Subject: Re: [Monotone-devel] Workspace merge?
Date: Sat, 01 Sep 2007 05:54:51 -0400
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt)

On 11 Jul 2007, Zack Weinberg wrote:

> The present state of play is, you can do 'mtn merge_into_workspace
> <revision>' which will merge <revision> with the current workspace's
> parent (I forget what happens if there are local changes; I think it
> errors out) and dump the result into the workspace.  You can mess
> with that as you like and commit it once you're happy.
>
> However, conflict resolution is just like 'mtn merge' -- if there
> are file-content conflicts, you have to resolve them immediately,
> and if there are name conflicts it errors out.

For the conflicts, I found it convenient to have a merger that leaves
the conflicts in the file, and returns "true" to mtn:

mergers.diff3_keep_conflicts = {
   cmd = function (tbl)
       local cmd =
          "diff3 --merge " ..
          -- Converting backslashes is necessary on Win32, since sh
          -- string syntax says '\' is an escape.
          string.format("--label \"%s [left]\" ",     tbl.left_path) ..
          string.format("--label \"%s [ancestor]\" ", tbl.anc_path) ..
          string.format("--label \"%s [right]\" ",    tbl.right_path) ..
          " " .. string.gsub (tbl.lfile, "\\", "/") ..
          " " .. string.gsub (tbl.afile, "\\", "/") ..
          " " .. string.gsub (tbl.rfile, "\\", "/") ..
          " > " .. string.gsub (tbl.outfile, "\\", "/")
       local ret = execute("sh", "-c", cmd)
      return tbl.outfile
   end,
   available =
      function ()
          return program_exists_in_path("diff3") and
                 program_exists_in_path("sh");
      end,
   wanted =
      function ()
           return true
      end
}

Then I can run Emacs smerge-ediff on each conflicted file to manually
resolve the conflicts before committing.

This also helps with propagate, although then the conflicted files are
committed. That's still better than having to resolve the conflicts
immediately.

Should I add this merger to std_hooks.lua? Obviously it should not be
in the list of automatic choices; the user can select it by setting
the MTN_MERGE environment variable.

Hmm. I guess I should rewrite it to use 'cmd' instead of 'sh', since
not everyone has Cygwin or even MinGW. 

Or I could put it in contrib.

-- 
-- Stephe





reply via email to

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