How can I release locks in Subversion recursively?

前端 未结 9 1224
青春惊慌失措
青春惊慌失措 2021-02-01 12:24

I am having a problem with version control in Subversion. I checked out a working copy from respository and got locks on all of its files. Then, without releasing the locks I ha

相关标签:
9条回答
  • 2021-02-01 13:04

    From the advance locking section

    $ svn status -u
    M              23   bar.c
    M    O         32   raisin.jpg
           *       72   foo.h
    Status against revision:     105
    $ svn unlock raisin.jpg
    svn: 'raisin.jpg' is not locked in this working copy
    

    That simply means the file is not locked in your current working directory , but if it is still locked at the repository level, you can force the unlock ("breaking the lock")

    $ svn unlock http://svn.example.com/repos/project/raisin.jpg
    svn: Unlock request failed: 403 Forbidden (http://svn.example.com)
    $ svn unlock --force http://svn.example.com/repos/project/raisin.jpg
    'raisin.jpg' unlocked.
    

    (which is what you did through the TortoiseSVN GUI)

    0 讨论(0)
  • 2021-02-01 13:09

    Doing an SVN cleanup will release the lock as well:

    $ svn cleanup
    
    0 讨论(0)
  • 2021-02-01 13:11

    The repository administrator can remove the locks (recursively), operating on hundreds of files inside a problematic directory -- but only by scripting since there is not a --recursive option to svnadmin rmlocks.

    $repopath=/var/svn/repos/myproject/;
    $problemdirectory=trunk/bikeshed/
    IFS=$'\n'; for f in $(sudo svnadmin lslocks $repopath $problemdirectory \
    | grep 'Path: ' \
    | sed "s/Path: \///") ; \
    do sudo svnadmin rmlocks $repopath "$f" ; done
    

    This solution works with filenames that have spaces in them.

    0 讨论(0)
  • 2021-02-01 13:19

    For me deleting the lock file inside .svn did not work since I got bad checksum msg after trying to update the file.

    I got the following msg after executing svn cleanup inside the directory:

    svn: In directory '' svn: Can't copy '.svn/tmp/text-base/file_name.svn-base' to 'filename.3.tmp': No such file or directory

    So I copied my file to .svn/tmp/text-base and changed the name to file_name.svn-base. Then cleanup and update worked fine.

    0 讨论(0)
  • 2021-02-01 13:21

    When I tried to run the script from above as originally provided, I was getting an error when it tried to set the variables: ./scriptname: line1: =/svn/repo/path/: No such file or directory ./scriptname: line2: =directory/: No such file or directory

    I removed the '$' from the first two lines and this worked perfectly after that.

    repopath=/var/svn/repos/myproject/;
    problemdirectory=trunk/bikeshed/
    IFS=$'\n'; for f in $(sudo svnadmin lslocks $repopath $problemdirectory \
    | grep 'Path: ' \
    | sed "s/Path: \///") ; \
    do sudo svnadmin rmlocks $repopath "$f" ; done
    
    0 讨论(0)
  • 2021-02-01 13:25

    If somebody else has locked the files remotely, I found that using TortoiseSVN 1.7.11 to do the following successfully unlocked them in my working copy. (similar to vikkun's answer)

    • Right click working copy > Check for modifications
    • Click Check repository button
    • Select files you wish to unlock
    • Right click > Get lock
    • Check "Steal the lock" checkbox
    • After lock is stolen, select again
    • Right click > Release lock

    Files in working copy should now be unlocked.

    0 讨论(0)
提交回复
热议问题