Including new files in SVN diff

后端 未结 2 1121
无人及你
无人及你 2021-02-01 03:09

I have a script which builds my application, uploads it to a remote machine, runs a performance test there and captures some metrics that I care about. The script creates a patc

2条回答
  •  春和景丽
    2021-02-01 03:40

    Thanks Alexandre. At first, his approach didn't work in my case. I was sure all new files were maked A in svn status, however, the diff file was still empty. Finally, I found the difference in svn status outputs, the fourth columns in my case are all populated with +, like:

    $ svn st
    M      .
    A  +    New.java
    

    This means the item is scheduled for addition-with-history[1]. This typically happens when you svn move or svn copy a file or directory[2]. In my case, the New.java is svn merged from another branch, including previous commit history in that branch. Let's removed these history information.

    First, find all addition-with-history items:

    svn status | grep ^A | sed -r 's/^A[ +]+//' > /tmp/add_list
    

    Optionally, remove directory paths in /tmp/add_list to avoid warnings in next step.

    Next, remove their history commit information by svn remove:

    xargs -r -d '\n' svn remove --keep-local --force < /tmp/add_list
    

    Then, go back to Alexandre's solution to add them to subversion again and get the diff.

    References:

    [1]http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.status.html
    [2]http://www.linuxtopia.org/online_books/programming_tool_guides/version_control_with_subversion/svn.ref.svn.c.status.html
    

提交回复
热议问题