How do you rename a branch in CVS?

落花浮王杯 提交于 2019-12-04 18:22:08

问题


If you've named a branch in CVS incorrectly, or the name originally chosen becomes inappropriate, how do you change it to something else?

A related question is How do you rename a branch in CVS without admin access?.


回答1:


The trick to this is using one of CVSs' more obscure admin commands, -N. It is a two stage process, effectively copy then remove.

Firstly, you create a branch with the correct name that references the original branch name. Secondly, you delete the original branch name.

Assume you have a file "File.txt" that is currently branched "bad_branch". You'd like the branch to be called - can you guess? - "good_branch".

kwutchak% cvs log File.txt

RCS file: .../data/File.txt,v
head: 1.1
branch:
symbolic names:
bad_branch: 1.1.0.2

To create the new branch reference:

cvs admin -N good_branch:bad_branch File.txt

kwutchak% cvs log File.txt

RCS file: .../data/File.txt,v
Working file: File.txt
head: 1.1
branch:
symbolic names:
good_branch: 1.1.0.2
bad_branch: 1.1.0.2

To delete the original reference:

cvs admin -N bad_branch File.txt

kwutchak% cvs log File.txt

RCS file: .../data/File.txt,v
Working file: File.txt
head: 1.1
branch:
symbolic names:
good_branch: 1.1.0.2




回答2:


As I cannot add comments to given answers yet (reputation to low), I want to remark that the given command in previous answer is missing double-quotes!

Correction:

grep "old-branch-name" * -rl | xargs sed -i 's/old-branch-name/new-branch-name/g'



回答3:


If you made a mistake "a few branches ago", admin -N option won't be helpful due to the branch position change.

This solution will work only with full access to repository of Your project.

  1. Go to CVSROOT/Project
  2. Create a backup copy
  3. grep "old-branch-name" * -rl | xargs sed -i 's/old-branch-name/new-branch-name/g'

Worked like a charm for me.

Sorry for necro, but I think that my solution will help anyone with situation similiar to mine.



来源:https://stackoverflow.com/questions/1108054/how-do-you-rename-a-branch-in-cvs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!