开发者

CVS: show files that are locally changed

开发者 https://www.devze.com 2022-12-16 08:29 出处:网络
Is there any simple way to show only the files in my repository that have been locally added, removed, or modified? I know that I can type \"cvs stat\" and look through the list of files, but th开发者

Is there any simple way to show only the files in my repository that have been locally added, removed, or modified? I know that I can type "cvs stat" and look through the list of files, but th开发者_如何学JAVAat is tedious and error-prone. I am wondering if there is an easier way. I am using CVS 1.11.17, in case that matters.


A 'dummy' update will give you this information.

cvs -qn update

A short description of the used options:

-q      Cause CVS to be somewhat quiet.
-n      Do not execute anything that will change the disk.


You can get a short listing of differences using the cvs diff command:

cvs -q diff --brief


Pipe it to grep!

cvs -Q status | grep -i locally


Here is what I use:

cvs -Q status | grep -A 4 Locally | egrep -v '^\-\-|^   Working|^   Commit|^$' | awk '{print $2 " " $4}' | sed -e 's/\<Locally\>//;s/revision: \CVS-REPOSITORY-PATH/\t\t/'

Output:

pin_stages.ref 
            tests/unit/ccsn/pin_stages/pin_stages.ref,v
pin_stages_func.ref 
            tests/unit/ccsn/pin_stages_func/pin_stages_func.ref,v


Here is nmake-perl script list modified files, it is based on aforesaid cvs update -qn:

DIRS=\
  c:\project1\
  c:\project2

all: $(DIRS)
  !cd $? & cvs -qn update | perl -ne "s!\/!\\!g;print '$?\\'.qq($$1) if /^M (.*)/s;"


Do a CVS Update Files prepended with M are modified files.

Example:

CVS Update
cvsntsrv server: Updating dat/idv
M dat/idv/conduct.idv  = Modified
...


As an alternative to commonly mentioned cvs update -qn, you can go for cvs release command. But this one is interactive and asks for confirmation at the end of the output (so you just need to abort it!). Normal output:

> cvs release .
...
U some/updated/file
M some/modified/file
...
You have [1] altered files in this repository.
Are you sure you want to release directory `.': n
** `release' aborted by user choice.
>

After question Are you sure you want to release directory '.': you put something different than y or Y.


you can use following command to get the list of files you modified locally

cvs -qn update | grep "M " | awk '{print $2}'

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号