I've got a project that has a config file which I've modified. I want to commit everything I have except the config file. This is the status of svn.
? web/trunk/webroot/tmp
M web/trunk/webroot/css/styles.css
M web/trunk/views/posts/list_all.ctp
M web/trunk/config/core.php
And this is the command I run.
svn st | grep ? -v | grep config/core.php -v | awk '{print $2;}' | xargs sudo svn commit
But I keep getting this message.
Received SIGHUP or SIGTERM
svn: Commit failed (details follow):
svn: system('/usr/bin/editor svn-commit.tmp') returned 256
Any suggestions on how to fix this problem would be really appreciated.
EDIT: This is kinda interesting. I echoed the result one and this is what I got.
svn st开发者_运维百科 | grep ? -v | grep gearman -v | awk '{print $2;}' | xargs echo | awk '{ print "sudo svn commit " $0; }'
Output:
sudo svn commit web/trunk/webroot/css/backend.css web/trunk/views/store_subscribers/list_all.ctp
Running the above result manually works fine but when I piped it into sh,
svn st | grep ? -v | grep gearman -v | awk '{print $2;}' | xargs echo | awk '{ print "sudo svn commit " $0; }' | sh
Output:
Received SIGHUP or SIGTERM
svn: Commit failed (details follow):
svn: system('/usr/bin/editor svn-commit.tmp') returned 256
Try:
sudo svn -q commit
-q
is the silent switch and should not force svn to open up the editor to put in a commit message :)
Ideally you should also specify a message via the -m
switch
http://svnbook.red-bean.com/en/1.1/re06.html
You can simulate the convenience of xargs
with backticks
Instead of:
svn st | grep ? -v | grep config/core.php -v | awk '{print $2;}' | xargs sudo svn commit
You can try:
svn ci `svn st | grep ? -v | grep config/core.php -v | awk '{print $2;}'`
Just drop the xargs
command at the end, wrap your query in backticks
, and add svn ci
to the front of your example.
Mainly you need to svn add
before you svn commit
. For example, this doesn't work:
$ touch testfile
$ svn st
$ svn commit testfile -m 'playing with svn'
svn: Commit failed (details follow):
svn: '/cygdrive/c/web/cpoe_ordersets/testfile' is not under version control
But if I remember to svn add
it it works.
$ svn add testfile
A testfile
$ svn commit testfile -m 'playing with svn'
Adding testfile
Transmitting file data .
Committed revision 1505.
So you might want to add an svn add
command to your pipeline before the commit, or more likely what you really want is to
- run
svn add * --force
in the root directory to add all unversioned files, then svn revert config/core.php
which you don't want added- run
svn commit -m "I added some unversioned files"
in the root directory to commit all the added files.
精彩评论