简体   繁体   English

StarTeam用户的Subversion概念

[英]Subversion concepts for a StarTeam user

I would like to know how to do the following common StarTeam tasks in SVN 我想知道如何在SVN中执行以下常见的StarTeam任务

1. How to update a tag to include a newer revision of just 1 file? 1.如何更新标签以包含仅1个文件的较新版本?

After creating a View Label in StarTeam (similiar to a tag in SVN) - I was able to include a newer revision of a file into that view label - eg update the view to include only that file (and not others that also changed since the creation of that View Label 在StarTeam中创建视图标签后(类似于SVN中的标签) - 我能够在该视图标签中包含更新的文件版本 - 例如,更新视图以仅包含该文件(而不包括自该文件以来也发生更改的其他文件)创建该视图标签

2. How to create a tag based on another tag? 2.如何根据另一个标签创建标签?

When development continues while releasing a version, some features are not to be included although they are checked in. In StarTeam, I used to create a view label (again, like a tag) based on a previous view (and then do what I describe in question 1). 在发布版本的同时继续开发时,虽然签入了一些功能,但是不会包含一些功能。在StarTeam中,我曾经基于先前的视图创建了一个视图标签(再次像标签一样)(然后执行我描述的内容)问题1)。 I understand that in SVN I can create a tag based on another, but that it is read only, and I need a branch. 据我所知,在SVN我可以创建一个基于另一个的标签,但它是只读的,我需要一个分支。 but I don't really need a branch, really. 但我真的不需要分支机构。

3. How to check-in / add to an existing tag? 3.如何签入/添加现有标签?

In StarTeam the view label is on the trunk / branch, so I could check in a file after a view is created and modify the lable to include it, in SVN I have to check into the branch 在StarTeam中,视图标签位于主干/分支上,因此我可以在创建视图后检入文件并修改标签以包含它,在SVN中我必须检查分支

Let me preface by saying I'm not familiar with StarTeam, so I may not fully understand the workflow you're trying to reproduce. 让我先说我不熟悉StarTeam,所以我可能不完全理解你试图重现的工作流程。

Subversion itself doesn't differentiate between tags and branches. Subversion本身不区分标签和分支。 By convention, a tag is just a branch that you never modify. 按照惯例,标签只是一个您永远不会修改的分支。 Even a branch is just an "svn copy" operation, there isn't a separate "branch" feature. 即使分支只是一个“svn copy”操作,也没有单独的“分支”功能。 A branch is just a cheap copy, and a tag is a branch that is read-only by convention only. 分支只是一个廉价的副本,而标记只是按惯例只读的分支。 Copies in svn are very cheap, so you don't need to worry about creating branches a lot - a tag is not any cheaper than a branch. svn中的副本非常便宜,所以你不必担心创建分支 - 标签不比分支便宜。 You may want to read the docs on Creating a Branch . 您可能想阅读有关创建分支的文档。 It further explains things... and has a boxed section about "Cheap Copies". 它进一步解释了一些事情......并且有一个关于“廉价副本”的盒装部分。

Depending on your use of "View Labels" in StarTeam, it is possible that svn externals may be useful for your purposes. 根据您在StarTeam中使用“查看标签”的情况, svn externals可能对您的用途有用。 I don't generally like them, but it depends on the scenario. 我一般不喜欢它们,但这取决于场景。

On to your questions more directly... 更直接地回答你的问题......

1) This will depend on if there are other changes in the file. 1)这取决于文件中是否有其他更改。 Do you want the changes from one revision in one file? 您是否希望在一个文件中对一个修订进行更改? Or all changes for 1 file (multiple revisions, only the 1 file). 或者1个文件的所有更改(多个修订版,只有1个文件)。 Hopefully you mean the former. 希望你的意思是前者。 In which case, the usual behavior would be to merge 在这种情况下,通常的行为是合并

Let's say you have the following scenario: 假设您有以下情况:

------------------------------------> /trunk
 |     | fix merged to 1.0 branch
 |     v
  \------------> /branches/1.0
    |  ^ |
    |    \ /tags/1.1  1.1 tag, fix released to customer(s)
    \ /tags/1.0 - 1.0 GA tag, release sent to customer(s)

You develop on trunk. 你在干线上发展。 At revision 10, your product is already ready to ship 1.0! 在修订版10中,您的产品已准备好发货1.0! You create a branch with: 您创建一个分支:

svn copy /path/to/trunk /path/to/branches/1.0

You then continue developing on trunk, while also doing a bit of extra verification on the 1.0 branch. 然后继续在trunk上进行开发,同时在1.0分支上进行一些额外的验证。 When it is ready to ship, you create a tag: 准备好发货时,您可以创建一个标签:

svn copy /path/to/branches/1.0 /path/to/tags/1.0

This tag is a frozen point in time that exactly matches what you are shipping to customers. 此标记是一个冻结的时间点,与您向客户发送的内容完全匹配。

You discover a bug/feature/update that is needed for your 1.0 release customers that has already been done on trunk. 您发现已在trunk上完成的1.0版本客户所需的错误/功能/更新。 In your case, you've stated changes to a particular file. 在您的情况下,您已声明对特定文件的更改。

Let's say the changes occurred on trunk in revision 15. You'd then do (from a clean /branches/1.0 working copy): 假设更改发生在版本15的主干上。然后你会这样做(从一个干净的/branches/1.0工作副本):

svn merge -c 15 /url/to/repo/path/to/trunk

In the ideal case, the changes of a revision are self-contained and all files in the revision are needed. 在理想情况下,修订的更改是自包含的,并且需要修订中的所有文件。 Sometimes there is also extra things you do not want to merge. 有时候还有一些你不想合并的东西。 In this case, after the merge, revert the changes to files you do not want merged, test everything, and then commit. 在这种情况下,在合并之后,将更改还原到您不想合并的文件,测试所有内容,然后提交。 There is a downside to the merge -> revert some files -> commit workflow, which is that subversion will record the merge as happening, yet you've excluded portions of it. 合并有一个缺点 - >恢复一些文件 - >提交工作流,这是subversion将记录合并发生,但你已经排除了它的一部分。 If the branch in question isn't likely to change much further (or reintegrate to another branch) it may not matter, but I prefer creating a patch file for the changes in the 1 file you want and applying them to the branch manually for cases like that. 如果有问题的分支不太可能进一步改变(或重新集成到另一个分支),这可能无关紧要,但我更喜欢为您想要的1文件中的更改创建补丁文件,并手动将它们应用于分支像那样。 I'm not 100% certain on the cmd line syntax, but I think it would be quite similar: 我不是100%肯定cmd行语法,但我认为它会非常相似:

svn diff -c 15 /path/to/file (in repo or other working copy) > my-patch.diff svn diff -c 15 / path / to / file(在repo或其他工作副本中)> my-patch.diff

and apply with another tool. 并使用其他工具。 I usually create/apply patches in a GUI, so the specifics will be left as an exercise to you. 我通常在GUI中创建/应用补丁,因此具体细节将作为练习留给您。

Once done with that, you create a new tag off your branch again, that will contain your new merged change. 完成后,再次在分支上创建一个新标记,其中包含新的合并更改。

svn copy /path/to/branches/1.0 /path/to/tags/1.1 svn copy /path/to/branches/1.0 /path/to/tags/1.1

You then have a new tag that is the same as the old tag, except for having the changes to the 1 file. 然后,您有一个与旧标记相同的新标记,除了对1文件进行更改。 In #3 I will also mention that you can recreate the tag (though it depends what you are using the tag for on whether it is a good idea). 在#3中我还会提到你可以重新创建标签(虽然它取决于你使用标签的内容是否是一个好主意)。 r, but I would only do this if the tag does not represent shipped code. r,但我只会在标签不代表发货代码的情况下执行此操作。

2) Indeed, since by convention a tag is read only, a tag from another tag would not really be different. 2)实际上,由于按照惯例,标签是​​只读的,因此来自另一个标签的标签实际上不会有所不同。 However, if you instead use a branch for the first one, then create a tag off that (as suggested), you can later create a second tag based off of the same branch (after committing additional changes) and it will differ from your first tag by only the changes that have been applied to that branch since then. 但是,如果您改为使用第一个分支,然后创建一个标记(如建议的那样),您可以稍后根据同一分支创建第二个标记(在提交其他更改之后),它将与您的第一个不同仅标记从那时起应用于该分支的更改。

3) Again, you would normally use a branch. 3)同样,你通常会使用一个分支。 If the branch/tag is used solely internally (I do not recommend ever deleting a release tag of shipped code, although it isn't really "lost", it just shouldn't normally be necessary - ), you can just delete & recreate the tag. 如果分支/标记仅在内部使用(我建议删除已发布代码的发布标记,虽然它不是真的“丢失”,但通常不应该 - ),你可以删除并重新创建标签。 Consumers of your tag (working copies) can just do a normal "svn update" after the tag is deleted & recreated and will continue to work fine as if nothing happened. 标签(工作副本)的消费者可以在删除并重新创建标记后执行正常的“svn更新”,并且可以继续正常工作,就好像什么也没发生一样。 This couldn't be used for #1 but could be for #2 when really you just want to update a tag. 这不能用于#1,但是当你真的想要更新标签时可以用于#2。 The trick is combine tagging and branching to achieve what you want. 诀窍是结合标记和分支来实现您想要的。 If you're also using this to deploy toa website or something, you can combine branching, tagging, and externals. 如果您还使用它来部署到网站或其他东西,您可以组合分支,标记和外部。

eg /path/to/production can be checked out which has an externals entry to /tags/1.0, and when you want to apply a fix you perform the steps in #2 and create a /tags/1.1 and adjust the externals entry. 例如/ path / to / production可以签出,其中包含/tags/1.0的外部条目,当你想要应用修复时,你执行#2中的步骤并创建一个/tags/1.1并调整外部条目。 Or, just have it point at the branch and no need to recreate tags. 或者,只需将其指向分支,无需重新创建标记。

I hope that is a semi-useful start. 我希望这是一个半有用的开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM