Exclude some files on svn command line commit (not svn:ignore)

后端 未结 7 594
失恋的感觉
失恋的感觉 2021-01-17 11:50

I\'m developing with many people.

I check out remote repository, get 3 file. After edit, run:

svn status

It shows:

         


        
相关标签:
7条回答
  • 2021-01-17 12:24

    Expanding upon zoul's answer.. to develop your list of files use:

    svn stat |  grep -v ignore.file | perl -ne 'chop; s/^.\s+//; print "$_ "'
    

    Or if you have file names with spaces use:

    svn stat |  grep -v ignore.file | perl -ne 'chop; s/^.\s+//; print "\"$_\" "'
    
    0 讨论(0)
  • 2021-01-17 12:24

    Just append the paths of the files to commit to the svn commit command:

    svn commit file_1 file_2
    

    See http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.commit.html

    0 讨论(0)
  • 2021-01-17 12:27

    I wound up making a script containing the following:

    svn ci $(svn diff --summarize | \
        grep -v exclude.file1 | \
        grep -v exclude.file2 | \
        ...
        grep -v exclude.fileN \
    )
    

    I'm sure someone can make it even more flexible by making this script read a file which would contain a list of files to be excluded from the commit.

    0 讨论(0)
  • 2021-01-17 12:29

    Here's a windows powershell version that commits only files that aren't in a changelist. Create a changelist called ignore-on-commit (which Tortoise SVN will understand anyway) and put the files you don't want to commit into it.

    # get list of changed files into targets
    [XML]$svnStatus = svn st -q --xml C:\SourceCode\Monad
    # select the nodes that aren't in a changelist
    $fileList = $svnStatus.SelectNodes('/status/target/entry[wc-status/@item != "unversioned"]') | Foreach-Object {$_.path};
    # create a temp file of targets
    $fileListPath =  [IO.Path]::GetTempFileName();
    $fileList | out-file $fileListPath -Encoding ASCII
    # do the commit
    svn commit --targets $fileListPath -m "Publish $version" --keep-changelists 
    # remove the temp file
    Remove-Item $filelistPath
    
    0 讨论(0)
  • 2021-01-17 12:38

    one line for bash:

    svn ci $(svn stat | grep -v exclude.file)
    
    0 讨论(0)
  • 2021-01-17 12:40

    maybe you can use this command.

    svn ci `svn st | grep -e "^[A|M]" | grep -v "test.js" | grep -ve "conf\.js$" | awk '{print $2}' | tr "\\n" " "`
    
    0 讨论(0)
提交回复
热议问题