代码之家  ›  专栏  ›  技术社区  ›  Nick Edwards Shiv Ram

如何在subversion中找到从中复制文件的路径

  •  0
  • Nick Edwards Shiv Ram  · 技术社区  · 7 年前

    svn move foo.py bar.py 然后 svn status

    $ svn move foo.py bar.py
    $ svn status
    A  +    bar.py
        > moved from foo.py
    

    另一方面,如果我进行复制,则输出不会显示新文件从何处复制:

    $ svn copy foo.py bar.py
    $ svn status
    A  +    bar.py
    

    bar.py , svn diff foo.py ,但不幸的是,头错误地将原始文件路径显示为 在回购协议中尚不存在的修订版。

    Index: bar.py
    ===================================================================
    --- bar.py   (revision 14283)
    +++ bar.py   (working copy)
    @@ -1,15 +1,14 @@
    
    ....
    

    棒.py

    2 回复  |  直到 7 年前
        1
  •  1
  •   royalTS    7 年前

    这个 svn log verbose 选项。这还将打印从中复制文件的路径。 http://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.log.html

        2
  •  0
  •   P. Le Sager    7 年前

    如果我理解正确的话,你的代码评审工具只接收diff。你有两个操作,复制和编辑,你的工具需要知道这两个操作。简单的 svn diff 只报告编辑,不报告副本。

    1. 使用: svn diff --show-copies-as-adds . 这将显示文件的先前版本不存在。比较(file4是svn复制和编辑的文件):

      [843] >>> svn diff
      Index: file4
      ===================================================================
      --- file4   (revision 5)
      +++ file4   (working copy)
      @@ -1 +1,2 @@
       some text
      +more more
      

      具有

      [844] >>> svn diff --show-copies-as-adds
      Index: file4
      ===================================================================
      --- file4   (nonexistent)
      +++ file4   (working copy)
      @@ -0,0 +1,2 @@
      +some text
      +more more
      
    2. 承诺然后 svn diff -r PREV (您始终可以在之后回滚提交)。您将得到相同的结果:

      [845] >>> svn ci -m "copied and edited"
      Adding         file4
      Transmitting file data .done
      Committing transaction...
      Committed revision 6.
      
      [846] >>> svn up
      Updating '.':
      At revision 6.
      
      [847] >>> svn diff -r PREV
      Index: file4
      ===================================================================
      --- file4   (nonexistent)
      +++ file4   (revision 6)
      @@ -0,0 +1,2 @@
      +some text
      +more more