简体   繁体   中英

SVN: analog of hg's addremove

We have a repository with several files (no folders). Each build time we have to download the same folder from another source (db), then commit to SVN changes - update existing, remove not existed and add new files.

So idea is to have 'copy' of db's scripts in SVN each build (that's why MSBuild is used)

Problem is that I don't know analog of hg 's addremove - which automatically synchronize two folders.

does anyone know how addremove can be simulated?

I personally have a little bash script to do that (being on linux):

svn status | grep "^\?" | gawk '{print $2}' | xargs -r svn add
svn status | grep "^\!" | gawk '{print $2}' | xargs -r svn remove

EDIT: Thanks to cesar , here's a simpler version:

svn status | gawk '/^\?.*/ {print $2}' | xargs -r svn add
svn status | gawk '/^\!.*/ {print $2}' | xargs -r svn remove

对于这种事情,我只是使用mercurial,并使用以下内容检入和退出svn: https//www.mercurial-scm.org/wiki/HgSubversion ...可能不是您想要的。

(Improvement of @Eric-Karl's answer)

Works for:

  • paths with 'space' chars
  • paths with '@' chars
  • paths with '\\' chars (in MSYS shell)

svn status | perl -ne 'print "$1\0" if /^\?\s+([^\r\n]+)/' | xargs -0 -r -I FILE svn add 'FILE@'
svn status | perl -ne 'print "$1\0" if /^\!\s+([^\r\n]+)/' | xargs -0 -r -I FILE svn remove 'FILE@'

svn_load_dirs.pl ,我总是使用svn附带的svn_load_dirs.pl脚本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM