Tortoise SVN合并到主干后更新分支

huangapple go评论54阅读模式
英文:

Tortoise SVN update a branch anfter merging to trunk

问题

早上好,

两位开发人员,例如Bill和Max,正在使用Tortoise SVN,并为项目创建了一个主干(称为"prj-trunk");之后,他们使用Tortoise的分支/标签选项创建了两个分支,每个开发人员一个(称为"prj-branch-max"和"prj-branch-bill")。
在他的分支中,Max进行了一些修改,而Bill在另一个文件中进行了其他修改。
现在是合并到主干的时候了,所以一位开发人员使用Tortoise的"合并"选项将他的代码放入主干,然后另一位开发人员将他的文件"合并"到主干。
所以现在的情景是这样的:Prj-Trunk包含所有的修改,prj-merge-max只包含Max的修改,prj-merge-bill只包含Bill的修改。
那么,更新这两个合并并包含所有修改的最佳方式是什么?
我尝试的第一件事是,从已更新的prj-trunk开始,使用"合并"选项指向"prj-branch-max"进行合并,但是Tortoise SVN找不到任何修改(因此从Bill更新并合并到主干的文件没有被识别为新文件)。我还尝试使用"分支/标签"选项指向"prj-branch-max"创建另一个分支,但Tortoise SVN返回错误(提示"已经存在")。
那么正确的做法是什么呢?
谢谢你

总结:

时间 prj-trunk branch-max branch-bill
t0 创建文件A.c、B.c等等... 不存在 不存在
t1 没有修改 从主干创建分支 从主干创建分支
t2 没有修改 修改文件A.c 修改文件B.c
t3 从Max合并(A.c已更新,B.c旧) 没有修改 没有修改
t4 从Bill合并(两个文件都已更新) 没有修改 没有修改
t5 【没有修改】 尝试从主干合并,但未找到任何修改,因此TortoiseSVN中止了合并 【与Max一样】
t6 【没有修改】 尝试从主干分支(当然,这不是正确的过程,但这是最后一次尝试!)但已经存在,因此TortoiseSVN中止了分支 与Max一样
t7 【没有修改】 在本地删除文件夹并提交删除到服务器;之后再次从主干分支创建分支(该分支已包含所有修改)...这是错误的方式,但我没有找到其他解决方案 与Max一样

好,请有人告诉我如何从时间#4开始执行正确的过程来更新Bill和Max的分支?

英文:

Goodmorning,

Two devs, for example Bill and Max, are using tortoise SVN and they have created a trunk for a project (called "prj-trunk"); after that, they made two branch (with branch/tag option of tortise), one for each dev (called "prj-branch-max" and "prj-branch-bill").
In his branch Max made same modification and in the other Bill modify other file.
Now is time to merge in the trunk, so one dev use "merge" option of tortoise for put his code in trunk, and after that, other dev "merge" his file to trunk.
So the scenario now is that: Prj-Trunk with all modification, prj-merge-max only with max's modifications and prj-merge-bill with only bill's modification.
So what is the best way to update the two merge with all modification?
The first think I try is, starting with updated prj-trunk, make a merge with "merge" option pointing to "prj-branch-max" but tortoise SVN not find any modification (so the file updated from bill and merged in trunk, aren't recognized as new). I also try to make another branch with "branch/tag" option pointing to "prj-branch-max" but tortoise SVN return error (it say "already exist").
So what is correct way to do?
Thanks you

Resuming:

Time prj-trunk branch-max branch-bill
t0 creation with file A.c, B.c, etc.. not exist not exist
t1 no modification branch from trunk branch from trunk
t2 no modification fila A.c modified file B.c modified
t3 merge from Max (A.c updated, B.c old) no modification no modification
t4 merge from Bill (both file are updated) no modification no modification
t5 [no modification] try to merge from trunk BUT not found any modification, so merge aborted by TortoiseSVN [as for Max]
t6 [no modification] try to branch (off curse, is not the right procedure, but it is the last try!) from trunk BUT already exist, so branch aborted by TortoiseSVN as for Max
t7 [no modification] delete folder in local and commit the delete in server; after that brench another time from trunk (that is up-to-date with all modification)... this is the wrong way, but i didn't discover any other solution as for Max

Ok please someone can tell me how to do the correct procedure starting from time #4 for update bill and max's brench??

答案1

得分: 1

在Subversion中创建分支时,分支是在存储库中创建的。工作副本不受影响,需要切换到新创建的分支以进行更改。

使用命令行客户端和传统的主干-分支布局,可以执行以下命令;在TortoiseSVN中,可以使用类似的操作:

touch A.c B.c
svn add A.c B.c
svn commit -m"初始,空文件"
svn copy ^/trunk ^/branches/max -m"为Max创建分支"
svn copy ^/trunk ^/branches/bill -m"为Bill创建分支"

# 此时,工作副本仍然位于主干上
svn switch ^/branches/max
vi A.c # 进行更改,等等。
svn commit -m"Max对A的更改"

svn switch ^/branches/bill
vi B.c # 进行更改,等等。
svn commit -m"Bill对B的更改"

# 现在让我们将它合并到主干中
svn switch ^/trunk
svn merge ^/branches/max .
# 解决冲突,如果有的话(不应该有)
svn commit -m"合并Max的更改"
svn merge ^/branches/bill .
# 解决冲突,如果有的话(不应该有)
svn commit -m"合并Bill的更改"

# 现在让我们将这些更改合并到Max的分支中
svn switch ^/branches/max
svn merge ^/trunk .
# 解决冲突,如果有的话(不应该有)
svn commit -m"从主干合并"

# 对Bill也是一样的

有关分支和合并的更多信息,请参阅Subversion的权威资源,Red Bean Book

英文:

When creating a branch in Subversion, it is created in the repository. The working copy is unaffected and needs to be switched to the newly created branch in order to change it.

Using the command line client and the conventional trunk-branches layout, one would issue the following commands; in TortoiseSVN, one would use the analogous actions:

touch A.c B.c
svn add A.c B.c
svn commit -m"Initial, empty files"
svn copy ^/trunk ^/branches/max -m"Create branch for Max"
svn copy ^/trunk ^/branches/bill -m"Create branch for Bill"

# At this point, working copy is still on trunk
svn switch ^/branches/max
vi A.c # make changes, etc.
svn commit -m"Max' changes to A"

svn switch ^/branches/bill
vi B.c # make changes, etc.
svn commit -m"Bill's changes to B"

# Now let's bring it together in trunk
svn switch ^/trunk
svn merge ^/branches/max .
# Resolve conflicts, if any (there shouldn't be any)
svn commit -m"Merge Max' changes"
svn merge ^/branches/bill .
# Resolve conflicts, if any (there shouldn't be any)
svn commit -m"Merge Bill's changes"

# Now let's merge those changes to Max' branch
svn switch ^/branches/max
svn merge ^/trunk .
# Resolve conflicts, if any (there shouldn't be any)
svn commit -m"Merge from trunk"

# Same for Bill

For more information on branching and merging, refer to the canonical resource on Subversion, the Red Bean Book.

答案2

得分: -1

每个用户可以首先添加文件,然后提交到主分支。

Max更改了文件1,Bill更改了文件2:
Max需要执行:svn add main-repo(如果是新文件)然后提交 svn ci file1
Bill也一样

然后,您只需要更新您的仓库以获取最新的更新文件。

只要Bill和Max不在同一个文件上工作,比如说file0,您就不会有问题。

但如果他们在同一个文件上工作,svn无法处理这种情况,它只会接受最后更新的文件版本。

因此,您需要首先更新。

英文:

Each user can add files first then commit to the main branch.

Max changed file1 and Bill file2:
Max needs to do : svn add main-repo (if new file for ex) then commit svn ci file1
Same thing for Bill

Then you just need to update your repo so to have the last updates files.

As far as Bill and Max aren't working on the same file, file0 let's say, you won't have problem.

But if they work on the same file, svn can't handle this case, it will only take the last updated file version.

So you need to first update

huangapple
  • 本文由 发表于 2023年6月19日 20:24:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76506603.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定