[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Applying a patch multiple times

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Thu, 02 Apr 2009 17:48:31 +0200

Yannick Berker wrote:
> Hi everybody,
>
>
>
> I'm have been using TortoiseSVN 1.60 lately and noticed some weired
> behavior:
>
>
>
>
> Revision 1 of my file looks like this:
>
> (1) 1
>
> (2) 3
>
> (3) 4
>
> (4)
>
>
>
> Now I add the line 2 (you guess where) and create a patch - it looks
> like this:
>
> (1) Index: new.txt
>
> (2) ===================================================================
>
> (3) --- new.txt (revision 1)
>
> (4) +++ new.txt (working copy)
>
> (5) @@ -1,3 +1,4 @@
>
> (6) 1
>
> (7) +2
>
> (8) 3
>
> (9) 4
>
> (10)
>
>
>
> When I now revert my file to revision 1, I correctly get 1-3-4.
>
>
>
> Now I apply the patch which results in 1-2-3-4. Now I apply the patch
> again, and I already notice that TortoiseSVN does not mark the filename
> as "red" which signifies something like "file is different from the
> version in repository". I does not reload revision 1 from the
> repository, but appies to patch to the already patches file which
> results in 1-2-2-3-4 without any conflict.
>
>
>
> Now I apply the patch AGAIN and see that TortoiseSVN correctly marks the
> file as "red". Patching results in a conflict.
>
>
>
> Is this intended behaviour? Is this a feature or bug, and does it come
> from SVN or TortoiseSVN?

It comes because the patch file only contains one line of context to
check the patch against. The second time the patch still can be applied
cleanly.
That's just how it is: a patch file doesn't contain the whole file but
only the diff part with *some* context. That reduced information of a
patch file can lead to such situations.

> In addition to that, when creating a patch for a directory containing
> unversioned files and including these unversioned files (like 1-2-3) in
> the patch file, applying the patch multiple times results in
> multiplication of the contents of the unversioned file. That is, after
> the second patching, the unversioned contain their contents twice
> (1-2-3-1-2-3), after the third time it’s 1-2-3-1-2-3-1-2-3 and so on – I
> think you get the point. Is this intended behavior?

Again, it's the same situation: a patch of an added file has *no*
context but only added lines. Applying such a patch always works because
there are no context lines which don't match.

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1520541
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].

Received on 2009-04-02 17:49:19 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.