Show merge history before commit

svn log has the parameter --use-merge-history , which shows all the changes that are part of the merge.

How can I get the same merge information in my working copy before I commit?

eg. after running svn merge ... (sync merge), but before running svn ci I want to see and sum the logs for the commit message.

+4
source share
1 answer

Interest Ask. Unfortunately, the command line tools do not seem to support this use case directly. However, you can write a script that uses the svn mergeinfo and passes it to the svn log to get this information. The following bash script might be a good starting point.

 #! /bin/bash source="^/trunk" url="$( svn info | sed -ne '/^URL: /s///p' )" mergeinfo=(svn mergeinfo --show-revs=merged "$source") revs=($( diff <( "${mergeinfo[@]}" ) <( "${mergeinfo[@]}" "$url" ) | sed -ne '/^< r\([0-9]\+\)$/s//-c \1/p' | tac )) [[ -n "$revs" ]] && svn log "${revs[@]}" "$source" 

Update: The tricky part is figuring out which changes were merged in the working copy and were not made. The above script solved this problem as follows: first, it defines all the revisions that have been merged into the working directory, including both committed and uncommitted merges. Secondly, it defines all perfect mergers. And finally, he calculates the difference between these two sets.

+3
source

Source: https://habr.com/ru/post/1482099/


All Articles