开发者

How to switch cvs user in checked out directory

开发者 https://www.devze.com 2023-01-06 07:50 出处:网络
My co-worker checked out our source tree from cvs and made some local changes, and then gave me a copy of th开发者_Python百科e entire modified directory.When I try to do cvs operations on it, cvs is a

My co-worker checked out our source tree from cvs and made some local changes, and then gave me a copy of th开发者_Python百科e entire modified directory. When I try to do cvs operations on it, cvs is asking for his password. Is there a way to change the saved username in the cvs files within this directory so that I can continue working on it as if I had checked it out and made the changes?

We'd prefer not to check in this modified code or create any additional branches.

Thanks.


Found a solution:

A partial description is here: http://worldforge.org/doc/faq/cvs/#unix2

Here's what I did:

> find module_dir_name -regex .*CVS/Root -print0 | xargs -0 perl -p -i.orig -e "s/olduser/newuser/;"
> find module_dir_name -regex .*CVS/Root.orig -print0 | xargs -0 perl -p -i.orig -e "s/olduser/newuser/;"


Thanks for your solution, stupakov; it helped me a lot!. It can be slightly simpler (and more universal; I didn't have perl installed) with this command. Note that it handles both Root and Root.orig:

find module_dir_name -regex ".*CVS/Root\(.orig\)?" -print0 \
    | xargs -0 sed -i s/olduser/newuser/ 


The alternative with TortoiseCVS/CVSNT is to use the switch command: right click on the CVS-tracked directory in File Explorer and choose Switch... from the CVS submenu. You'll get a prompt for a new CVSROOT. For example, if your old CVSROOT is ":pserver:alice@cvs:/vol/cvsroot", type in ":pserver:bob@cvs:/vol/cvsroot" to switch the user from alice to bob. The change affects the whole subdirectory recursively.

Also possible to do from the command line:

PS> cvs switch -h
switch: invalid option -- h
Usage: cvs switch [-f] newroot
        -f      Change all roots, not just those matching the current directory.
(Specify the --help global option for a list of other help options)

However, note that this functionality is specific to CVSNT.

0

精彩评论

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

关注公众号