On Fri, Sep 10, 2021 at 4:45 AM Mikael Stålhammar <
mikael_stalham...@hotmail.com> wrote:

> I'm wondering if the behavior of "svn update" is correct in this below
> case:
>
> I have a file in my local working copy containing a change on one line in
> the file.
> Meanwhile the file is modified and committed by someone else, with a
> change to another line in that file.
> It turns out that that change made by the other person was wrong, so I
> want to stick with the contents of the file I have, so I do a:
>
> svn update <the file path> --accept mf
>


This would have an effect only if SVN detects conflicts it can't resolve
automatically when merging the repository's changes with your working
copy's changes. For example, that would happen if your colleague and you
both changed the same lines of the file (with non-identical changes).

In your case it sounds like there was no conflict as two different parts of
the file were edited.

One way to achieve what you want is to reverse cherry pick merge the bad
commit. (If it contains other changes you do want to keep, you can
selectively revert them using your favorite diff tool.)

See:
https://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo

Depending on the situation and whether your colleague's changes and yours
are related or not, it might be better to commit the "revert" commit
separately from your other changes so that it will be clear why it's being
reverted and can be explained in the log. You could do that either before
or after committing your own changes, or just in one combined commit,
depending on what is best in your circumstances.


(i.e. mf=mine-full)
> to mark my version as being merged with HEAD, but keeping my source as it
> is. However, what really happens is that the changes from that other
> revision still gets merged into my local source, while I expected the
> contents of my version to remain unchanged.
>


Note that your colleague's committed changes will not show up in a 'svn
diff' now since you are comparing your working copy with what's in the
repository (at the time of 'svn update') but reverse cherry picking that
commit will make those lines as they were before, and will make them show
up in the diff as changed.

Hope this helps,
Nathan

Reply via email to