Arjen and I are working together on the new Fortran binding and since
we are both doing lots of editing in the same files, the probability
of conflicts (where we both edit the same area of the file in our
individual commits so that the patch process fails) is higher than
normal.  Here is the first part of my notes on how I resolved those conflicts
with a second part still to come.

(By the way, Arjen.  You will see many long lines below starting with
"Implement the new Fortran interface for plcont...." The reason for
those long lines is you forgot to put a line break after the first
(summary) sentence in your commit message so we see the whole
paragraph rather than the first sentence below in a number of
different contexts.)

1.  First try

software@raven> git am < 
0001-Implement-the-new-Fortran-interface-for-plcont.-This.patch
Applying: Implement the new Fortran interface for plcont. This involves 
defining callback functions - the interface to these functions depends on the 
actual form they take their data arguments in. This is not entirely ideal as 
there is more code involved but earlier attempts via type(c_funptr) caused 
coredumps.
error: patch failed: bindings/f95/plplot_bindings.f90:27
error: bindings/f95/plplot_bindings.f90: patch does not apply
Patch failed at 0001 Implement the new Fortran interface for plcont. This 
involves defining callback functions - the interface to these functions depends 
on the actual form they take their data arguments in. This is not entirely 
ideal as there is more code involved but earlier attempts via type(c_funptr) 
caused coredumps.
The copy of the patch that failed is found in:
    /home/software/plplot/HEAD/plplot.git/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

The above makes no change in the working directory according to git
diff.  When I google searched for this issue I found
<http://stackoverflow.com/questions/25846189/git-am-error-patch-does-not-apply>
which explains the above result is because git am by default wants to
preserve atomicity.  The discussion there mentioned the -3 flag for
git am (although apparently that sometimes will not work), so I tried
that instead.

2. Second try

I backed out of the first try with

git am --abort

then ran

software@raven> git am -3 < 
0001-Implement-the-new-Fortran-interface-for-plcont.-This.patch
Applying: Implement the new Fortran interface for plcont. This involves 
defining callback functions - the interface to these functions depends on the 
actual form they take their data arguments in. This is not entirely ideal as 
there is more code involved but earlier attempts via type(c_funptr) caused 
coredumps.
Using index info to reconstruct a base tree...
M       bindings/f95/included_plplot_real_interfaces.f90
M       bindings/f95/plplot_bindings.f90
Falling back to patching base and 3-way merge...
Auto-merging bindings/f95/plplot_bindings.f90
CONFLICT (content): Merge conflict in bindings/f95/plplot_bindings.f90
Auto-merging bindings/f95/included_plplot_real_interfaces.f90
Failed to merge in the changes.
Patch failed at 0001 Implement the new Fortran interface for plcont. This 
involves defining callback functions - the interface to these functions depends 
on the actual form they take their data arguments in. This is not entirely 
ideal as there is more code involved but earlier attempts via type(c_funptr) 
caused coredumps.
The copy of the patch that failed is found in:
    /home/software/plplot/HEAD/plplot.git/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

This obviously got much further.  Also, if I run git diff, I get
conflict resolution markers in the affected files, e.g.,

++<<<<<<< HEAD
  +  private :: private_single, private_double
  + 
++=======
+ 
++>>>>>>> Implement the new Fortran interface for plcont. This involves 
defining callback functions - the interface to these functions depends on the 
actual form they take their data arguments in. This is not entirely ideal as 
there is more code involved but earlier attempts via type(c_funptr) caused 
coredumps.

in bindings/f95/plplot_bindings.f90, 
i.e., Arjen inserted a blank line (which destroyed patch context) in his
commit close to a line in that file where I had inserted

private :: private_single, private_double

followed by a blank line in my own commit.

Resolving such simple conflicts is easy (by editing the file, removing
the <<<<<<<*, =======, and >>>>>>>* lines which are the conflict
resolution markers and deciding which version to use (or merge both
versions sometimes). In this simple case I resolved the conflict by
choosing my version and deleting the blank line from Arjen's version.

There were a small number of other conflicts marked in that same file,
but in each case it was easy to resolve them.

3. Finishing up

3a.

After I had edited bindings/f95/plplot_bindings.f90 to resolve the
conflicts the status was as follows:

software@raven> git status
On branch new_f95_update
You are in the middle of an am session.
   (fix conflicts and then run "git am --continue")
   (use "git am --skip" to skip this patch)
   (use "git am --abort" to restore the original branch)

Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)

         modified:   bindings/f95/included_plplot_real_interfaces.f90

Unmerged paths:
   (use "git reset HEAD <file>..." to unstage)
   (use "git add <file>..." to mark resolution)

         both modified:   bindings/f95/plplot_bindings.f90

I then ran

git add bindings/f95/plplot_bindings.f90

to get my conflict resolutions into the index.

3b.  The status after that was

software@raven> git status
On branch new_f95_update
You are in the middle of an am session.
   (fix conflicts and then run "git am --continue")
   (use "git am --skip" to skip this patch)
   (use "git am --abort" to restore the original branch)

Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)

         modified:   bindings/f95/included_plplot_real_interfaces.f90
         modified:   bindings/f95/plplot_bindings.f90

3c.

I then ran

software@raven> git am --continue
Applying: Implement the new Fortran interface for plcont. This
involves defining callback functions - the interface to these
functions depends on the actual form they take their data arguments
in. This is not entirely ideal as there is more code involved but
earlier attempts via type(c_funptr) caused coredumps.
software@raven> git log --oneline -1
996b4a7 Implement the new Fortran interface for plcont. This involves defining 
callback functions - the interface to these functions depends on the actual 
form they take their data arguments in. This is not entirely ideal as there is 
more code involved but earlier attempts via type(c_funptr) caused coredumps.
software@raven> git status
On branch new_f95_update
nothing to commit, working directory clean

==> Complete success for the first patch.

In sum, for this case could use "git am -3" which lead to insertion of
conflict resolution markers directly into the affected file and easy
resolution of the issue by editing, "git add <edited file name>", "git
am --continue".

Arjen's second patch applied without issues, but his third patch again
had conflicts.  However, in this case the -3 option does not work (probably
because of the previous conflict resolution in this series of commits).

The error message was

software@raven> git am -3 < 
/home/irwin/Arjen.Markus/20151229/new_fortran/0003-Implement-the-simplest-plshade-interface-used-by-x15.patch
 
Applying: Implement the simplest plshade interface - used by x15f This test 
case brought a deficiency in the interface for plpat to light. It has been 
corrected, but it might result in some incompatibilities
fatal: sha1 information is lacking or useless 
(bindings/f95/included_plplot_real_interfaces.f90).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Implement the simplest plshade interface - used by x15f 
This test case brought a deficiency in the interface for plpat to light. It has 
been corrected, but it might result in some incompatibilities
The copy of the patch that failed is found in:
    /home/software/plplot/HEAD/plplot.git/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

The above URL implies you should use the --reject git am option when
-3 does not work, and I will say more about the practical details of
how you resolve conflicts in that case once I have evaluated the
contents of the first two patches and made any further commits to
allow comprehensive testing of those two.

But so far so good, and note the same conflict resolution would also
have had to be done if Arjen and I had both been attempting to push
our local commits to master rather than collaborating on this private
topic branch using the "git format-patch"/"git am" method.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to