Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get a short CVS status from command line?

Tags:

cvs

When doing a cvs update, you get a nice summary of the state of the repository, for example:

M src/file1.txt
M src/file2.txt
C src/file3.txt
A src/file4.txt
? src/file5.txt

Is there a way to get this without actually updating? I know there is cvs status, but this is way to verbose:

===================================================================
File: file6.txt        Status: Up-to-date

Working revision:    1.2
Repository revision: 1.2     /var/cvs/cvsroot/file6.txt,v
Sticky Tag:          (none)
Sticky Date:         (none)
Sticky Options:      (none)

I could of course make a script to do the transformation from the latter to the former, but it seems a waste of time since cvs can obviously produce the former.

like image 887
Johannes Hoff Avatar asked Oct 17 '08 11:10

Johannes Hoff


People also ask

Which command is used to update the files in cvs?

The commit command is used to place the changes you made to files in your local working directory back into the CVS repository.

How do I view cvs file history?

You can use the history file (see section The history file) to log various CVS actions. To retrieve the information from the history file, use the cvs history command (see section history--Show status of files and users).

What is cvs filing status?

The cvs status command is a quick way to determine which files are up-to-date and which need to be committed or merged. Files that have not been added to the repository are prefixed with a question mark (?).


3 Answers

You can use the -n flag to get the update output without actually updating the files. You can also add -q (quiet) to suppress any server messages.

cvs -q -n update
like image 181
jmcnamara Avatar answered Oct 07 '22 18:10

jmcnamara


@jmcnamara: Good tip!

And all this time I've been using this bash script:

cvs -q status "$@" | grep '^[?F]' | grep -v 'Up-to-date'
like image 40
Pistos Avatar answered Oct 07 '22 17:10

Pistos


I have some aliases, that may be useful for somebody:

alias cvsstatus_command='cvs -q status | grep "^[?F]" | grep -v "Up-to-date" | \
    grep -v "\.so" | grep -v "\.[c]*project"'

alias cvsstatus_color='nawk '"'"'BEGIN \
    { \
        arr["Needs Merge"] = "0;31"; \
        arr["Needs Patch"] = "1;31"; \
        arr["conflicts"] = "1;33"; \
        arr["Locally Modified"] = "0;33"; \
        arr["Locally Added"] = "0;32" \
    } \
    { \
        l = $0; \
        for (pattern in arr) { \
            gsub(".*" pattern ".*", "\033[" arr[pattern] "m&\033[0m", l); \
        } \
        print l; \
    }'"'"

alias cvsstatus='cvsstatus_command | cvsstatus_color'

This will display only file names and their status, ignore all up-to-date files, remove all eclipse project files and shared objects and will also print the lines in different colors, depending on the status (for example, I have orange for locally modified; red for files, needing merge; green for locally added, etc)

like image 4
Kiril Kirov Avatar answered Oct 07 '22 19:10

Kiril Kirov