examining history of deleted file

前端 未结 17 1880
臣服心动
臣服心动 2020-11-30 17:36

If I delete a file in Subversion, how can I look at it\'s history and contents? If I try to do svn cat or svn log on a nonexistent file, it complai

17条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 18:27

    Assume your file was named as ~/src/a/b/c/deleted.file

    cd ~/src/a/b/c  # to the directory where you do the svn rm or svn mv command
    #cd ~/src   # if you forget the correct directory, just to the root of repository
    svn log -v | grep -w -B 9 deleted.file | head  # head show first 10 lines
    

    sample output, found it at r90440

    ...
    r90440 | user | 2017-02-03 11:55:09 +0800 (Fri, 03 Feb 2017) | 4 lines
    Changed paths:
      M /src/a/b/c/foo
      M /src/a/b/c/bar
      D /src/a/b/c/deleted.file
    

    copy it back to previous version(90439=90440-1)

    svn cp URL_of_deleted.file@90439 .
    

提交回复
热议问题