How can I get a summary of my cvs conflicts when doing a cvs update on the command line?

Is there an easy way to get a conflict summary after running a cvs update?

I work on a large project and after doing some work I need to do an update. The list of changes coming back from the cvs update command is several pages long and I'd like to see only the list of conflicts (starts with 'C') repeated at the end of the cvs update command output.

The solution needs to work from the command line.

If my normal output is:

M src/file1.txt
M src/file2.txt
cvs server: conflicts found ...
C src/file3.txt
M src/file4.txt
M src/file5.txt

I want my new output to be:

M src/file1.txt
M src/file2.txt
cvs server: conflicts found ...
C src/file3.txt
M src/file4.txt
M src/file5.txt

Conflict Summary:
C src/file3.txt

I want this to be a single command (possibly a short script or alias) that outputs the normal cvs output as it happens followed by a summary of conflicts.

Answers


Given the specification, it seems that you need a minor adaptation of Martin York's solution (because that only shows the conflicts and not the normal log information). Something like this - which might be called 'cvsupd':

tmp=${TMPDIR:-/tmp}/cvsupd.$$
trap "rm -f $tmp; exit 1" 0 1 2 3 13 15
cvs update "$@" | tee $tmp
if grep -s '^C' $tmp
then
    echo
    echo Conflict Summary:
    grep '^C' $tmp
fi
rm -f $tmp
trap 0
exit 0

The trap commands ensure that the log file is not left around. It catches the normal signals - HUP, INT, QUIT, PIPE and TERM (respectively) and 0 traps any other exit from the shell.


Need Your Help

Getting wrong layout

android nullpointerexception dalvik

I decided to redo the homescreen for my application, so the first thing I did was to remove the specific landscape/portrait layouts and to use a simpler one. I also changed a GridView to a ListView...

ConcurrencyException

java concurrency synchronized concurrentmodification synchronized-block

private static HashMap<String, FileInfo> sFileInfoObjectList = new CacheLinkedHashMap<String, FileInfo>();

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.