You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Thomas Börkel <tb...@ap-ag.com> on 2005/02/02 15:07:00 UTC

Bug in merge (repro included)

HI!

I think we have found a bug in Subversion's merge command.

I am attaching 3 versions of the same file:
- TransportOutUtil-B1.java = Rev 1 in the branch
- TransportOutUtil-B2.java = Rev 2 in the branch
- TransportOutUtil-T.java = trunk

Now we are merging the diff between B1 and B2 into T.

The unified diff between B1 and B2 looks like this:

--------------------------------------------------

@@ -444,20 +444,20 @@
       if (vkRahmenObj != null) {
         vkRahmenObj.setGeliefert(vkRahmenObj.getGeliefert() - lieferMenge);
         vkRahmenObj.update();
+
+        where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
+                "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and " +
+                "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and " +
+                "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "' and
" +
+                "STATUS = 1";
+        lieferabrufInObj = LieferabrufInFactory.search2(manager,
+                                                        where,
+                                                        READ_LOCK,
+                                                        true);
+        LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
+        LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
       }

-      where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
-              "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and " +
-              "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and " +
-              "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "' and "
+
-              "STATUS = 1";
-      lieferabrufInObj = LieferabrufInFactory.search2(manager,
-                                                      where,
-                                                      READ_LOCK,
-                                                      true);
-      LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
-      LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
-
     } finally {
       manager.release();
     }

--------------------------------------------------

The code in the trunk looks slightly different there, so IMHO the merge
should result in a conflict (trying with GNU patch results in a failure).

But it doesn't. After the merge, the new block has just been added without
conflict and the old block has not been removed.

Before:
          if (vkRahmenObj != null) {
            vkRahmenObj.setGeliefert(vkRahmenObj.getGeliefert() -
lieferMenge);
            vkRahmenObj.update();

            where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
                    "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and
" +
                    "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and "
+
                    "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "'
and " +
                    "STATUS = 1";
            lieferabrufInObj = LieferabrufInFactory.search2(manager,
                                                            where,
                                                            READ_LOCK,
                                                            false);
            if (lieferabrufInObj != null) {

LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
              LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
            }


After the merge:

            where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
                    "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and
" +
                    "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and "
+
                    "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "'
and " +
                    "STATUS = 1";
            lieferabrufInObj = LieferabrufInFactory.search2(manager,
                                                            where,
                                                            READ_LOCK,
                                                            false);
            if (lieferabrufInObj != null) {

LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
              LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
            }
          }
        }

        where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
                "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and " +
                "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and " +
                "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "' and
" +
                "STATUS = 1";
        lieferabrufInObj = LieferabrufInFactory.search2(manager,
                                                        where,
                                                        READ_LOCK,
                                                        true);
        LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
        LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);


Are we thinking wrong?

Thanks!

Thomas


Re: Bug in merge (repro included)

Posted by Ben Collins-Sussman <su...@collab.net>.
Hm, can you resend your original bug recipe to the dev@ list?  I'd like 
the author of libsvn_diff to take a look.


On Feb 3, 2005, at 2:56 AM, Thomas Börkel wrote:

> HI!
>
> "Ben Collins-Sussman" <su...@collab.net> wrote in message
> news:f03bbf40e1c1d5a5d8f785117d446b9d@collab.net...
>
>> GNU diff and patch is doing only a 2-way diff, but 'svn merge' is 
>> doing
>> a 3-way comparison.  What does GNU diff3 do with the 3 files?
>
> If I understand the output of diff3 correctly, it finds a conflict on 
> that
> merge and that is correct IMHO:
>
> diff3 -E TransportOutUtil-T.java TransportOutUtil-B1.java
> TransportOutUtil-B2.java
>
> 486a
> =======
>       lieferMenge = waPosObj.getLiefermenge();
>       vkRahmenObj = VkRahmenFactory.search2(manager,
>                                             waPosObj.getVkrahmen(),
>                                             
> ObjectConstants.OPTIMISTIC_LOCK,
>                                             false);
>       if (vkRahmenObj != null) {
>         vkRahmenObj.setGeliefert(vkRahmenObj.getGeliefert() - 
> lieferMenge);
>         vkRahmenObj.update();
>
>         where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
>                 "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' 
> and " +
>                 "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and 
> " +
>                 "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + 
> "' and
> " +
>                 "STATUS = 1";
>         lieferabrufInObj = LieferabrufInFactory.search2(manager,
>                                                         where,
>                                                         READ_LOCK,
>                                                         true);
>         LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
>         LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
>       }
>
>>>>>>>> TransportOutUtil-B2.java
> .
> 445a
> <<<<<<< TransportOutUtil-T.java
>
>
> Thomas
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Bug in merge (repro included)

Posted by Thomas Börkel <tb...@ap-ag.com>.
HI!

"Ben Collins-Sussman" <su...@collab.net> wrote in message
news:f03bbf40e1c1d5a5d8f785117d446b9d@collab.net...

>GNU diff and patch is doing only a 2-way diff, but 'svn merge' is doing
>a 3-way comparison.  What does GNU diff3 do with the 3 files?

If I understand the output of diff3 correctly, it finds a conflict on that
merge and that is correct IMHO:

diff3 -E TransportOutUtil-T.java TransportOutUtil-B1.java
TransportOutUtil-B2.java

486a
=======
      lieferMenge = waPosObj.getLiefermenge();
      vkRahmenObj = VkRahmenFactory.search2(manager,
                                            waPosObj.getVkrahmen(),
                                            ObjectConstants.OPTIMISTIC_LOCK,
                                            false);
      if (vkRahmenObj != null) {
        vkRahmenObj.setGeliefert(vkRahmenObj.getGeliefert() - lieferMenge);
        vkRahmenObj.update();

        where = "KARTIKEL = '" + vkRahmenObj.getKartikel()+ "' and " +
                "EDIPARTNER = '" + vkRahmenObj.getEdipartner() + "' and " +
                "WERKKUNDE = '" + vkRahmenObj.getWerkkunde() + "' and " +
                "ABLADESTELLE = '" + vkRahmenObj.getAbladestelle() + "' and
" +
                "STATUS = 1";
        lieferabrufInObj = LieferabrufInFactory.search2(manager,
                                                        where,
                                                        READ_LOCK,
                                                        true);
        LieferabrufInUtil.unDispatchDeliverySchedule(lieferabrufInObj);
        LieferabrufInUtil.dispatchDeliverySchedule(lieferabrufInObj);
      }

>>>>>>> TransportOutUtil-B2.java
.
445a
<<<<<<< TransportOutUtil-T.java


Thomas




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Bug in merge (repro included)

Posted by Ben Collins-Sussman <su...@collab.net>.
On Feb 2, 2005, at 9:07 AM, Thomas Börkel wrote:
>
>
> The code in the trunk looks slightly different there, so IMHO the merge
> should result in a conflict (trying with GNU patch results in a 
> failure).
>
> But it doesn't. After the merge, the new block has just been added 
> without
> conflict and the old block has not been removed.
>

GNU diff and patch is doing only a 2-way diff, but 'svn merge' is doing 
a 3-way comparison.  What does GNU diff3 do with the 3 files?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org