Вопрос

svn log has a --use-merge-history option that shows all revisions that are part of the merge.

How can I get the same information for the merges in my working copy, before I commit?

E.g. after I run svn merge ... (sync merge) but before I run svn ci I want to see and summarize the logs for the commit message.

Это было полезно?

Решение

Interesting question. Unfortunately, the command line tools apparently do not support this use case directly. However, you can write a script, that uses the output of svn mergeinfo and feeds it to 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 to find out, which revisions have been merged in the working copy, and have not been committed. The above script solved this problem in the following way: First it determines all revisions, which have been merged in the working directory - including both committed and uncommitted merges. Second, it determines all committed merges. And finally it calculates the difference of these two sets.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top