Subversion 中的标记 - 我如何决定继续使用我的主干还是使用新标记?
我正在运行 Tortoise SVN 来管理一个项目。显然,标记的原则适用于 SVN 的任何实现,但在这个问题中我将参考一些特定于 TortoiseSVN 的对话框和消息。
我的工作目录和 subversion 存储库结构都有一个 Source 根目录和下面的 Trunk、Tags 和 Branches 目录。 (我无法弄清楚如何在不使用项目符号的情况下在 Markdown 中执行多级缩进层次结构,因此如果有人可以编辑并修复此问题,我将不胜感激。)
我正在工作副本中的 Trunk 目录中工作,它是指向存储库中的 Trunk 目录。我想应用标签“Release1”,所以我单击“Branch/tag...”菜单选项并将存储库路径设置为我的 [repo_path/bla/Source/Tags/Release1" 标签。此对话框为我提供了选项更改为“将我的工作副本切换到新分支/标签”。
我知道,如果未选中此选项,将在 /Tags 下创建新的“Release1”分支,但我的工作副本将保留在之前的“Trunk”路径上。如果我确实选中此选项(或使用 Switch 命令),我知道我的工作副本将切换到“/Tags”下的新“Release1”分支。
我缺少一个概念是如何做出这个决定。我似乎不想将工作目录切换到最近创建的标签,因为根据定义(?)我希望该标签成为我的代码在某个时间点的快照。如果我不切换工作目录,我将继续在主干上工作,当我准备好拍摄另一个快照时,我将创建另一个标签。等等...
我是否理解正确,或者我在上一段中陈述了错误的内容(例如,关于不想切换到标签的陈述,因为标签应该代表时间点快照)或者以其他方式遗漏了有关如何切换的内容做出这个决定?
I'm running Tortoise SVN to manage a project. Obviously the principles around tagging apply to any implementation of SVN but in this question I'll be referring to some TortoiseSVN-specific dialog boxes and messages.
My working directory and the subversion repository structure both have a Source root directory and the Trunk, Tags and Branches directories underneath. (I couldn't figure out how to do a multilevel indented hierarchy in markdown without using bullets, so if someone could edit and fix this I'd appreciate it.)
I'm working out of the Trunk directory in my working copy and it's pointing at the Trunk directory in the repo. I want to apply a Tag "Release1" so I click the "Branch/tag..." menu option and set the repo path as my [repo_path/bla/Source/Tags/Release1" tag. This dialog box gives me the option to "Switch my working copy to new branch/tag".
I understand that if this option is left unchecked, the new "Release1" branch under /Tags" will be created but my working copy will remain on the previous "Trunk" path. If I do check this option (or use the Switch command) I understand that my working copy will switch to the new "Release1" branch under "/Tags".
Where I'm missing a concept is how to make this decision. It doesn't seem like I want to switch my working directory to the recently created tag since by definition (?) I want that tag to be a snapshot of my code as of a point in time. If I don't switch the working directory, I'll continue working off Trunk and when I'm ready to take another snapshot I'll make another tag. And so on...
Am I understanding this right or am I stating something incorrectly in the previous paragraph (e.g. the statement about not wanting to switch to the tag since the tag should represent a point in time snapshot) or otherwise missing something regarding how to make this decision?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Subversion 中,标签不是您在修订版上放置的“标签”;而是您在修订版上添加的“标签”。它是某个时间点的主干(或分支或其他)的副本。只是一个复制的目录,您可以提交给它;但你不应该。
一旦你做了一个标签,你应该留在原来的地方(分支或主干)并在那里工作,不要切换到标签目录。如果您提交到标签目录,您将更改其内容,然后它就不再作为“快照”有用。
当你创建一个分支时,通常你会想要切换到它,但可能有一种情况你想在分支创建后留在主干中(例如,如果碰巧你注意到主干中有一个修复需要尽快完成);这是你的决定。您可以随时切换。当您创建标签时,无需做出太多决定;留在你所在的分支机构。我想不出切换到标签有任何用处的情况......
In Subversion, a tag is not a "label" you put on a revision; it's a copy of trunk (or a branch or whatever) at some point in time. Being just a copied directory, you could commit to it; but you shouldn't.
Once you do a tag, you should stay where you were (a branch or trunk) and work there, don't switch to the tag directory. If you commit to a tag directory, you'll change its contents, and then it's not being useful as a "snapshot" anymore.
When you create a branch, usually you would want to switch to it, but there may be a situation where you want to stay in trunk after the branch creation (eg. if coincidentally you notice there's a fix to do in trunk ASAP); it's your decision. You could always switch later at any time. When you create a tag, there isn't much of a decision to make; stay in the branch you are. I can't think of any case where switching to the tag would be of any use...
在 Subversion 中,技术上不存在“分支”或“标签”这样的东西。对于 SVN 来说,它们只是目录的副本。他们之所以特别,只是因为你对待他们的方式。
标签=复制一个项目,但复制后不要碰它。您通常不想切换到该标签,因为您(通常)不会在那里提交任何更改。
分支 = 复制一个项目,并在那里做一些工作。通常,您在分支中所做的工作会在某个时候与主干合并。如果您要立即创建一个分支,您可能想切换到该分支(选中该框)。
注意#1:虽然 SVN 本身没有对主干/分支/标签进行任何特殊处理,但 TortoiseSVN 确实有一个 UI 提示来阻止提交标签。如果您签出一个标签(或创建一个标签并切换到它),做一些工作,然后尝试提交,TSVN 将显示一条警告消息。 TSVN 尝试猜测您真正想要做什么。
注意#2:您不一定需要时间点快照的标记。存储库的修订号可以为您做到这一点。
In Subversion, there technically is no such thing as a "branch" or a "tag". To SVN, they are just copies of a directory. They are only special because of how you treat them.
Tag = make a copy of a project, but don't touch it after making a copy. You generally don't want to switch to the tag, because you (normally) won't be committing any changes there.
Branch = make a copy of a project, and do some work there. Generally work you do in a branch gets merged with the trunk at some point. If you are making a branch to work on immediately, you probably want to switch to the branch (check the box).
NOTE #1: While SVN itself does not have any special treatment of trunk/branches/tags, TortoiseSVN does have a UI hint to discourage committing to a tag. If you check out a tag (or make a tag and switch to it), do some work, then try to commit, TSVN will display a warning message. TSVN tries to guess what you were really trying to do.
NOTE #2: You don't necessarily need a tag for a point-in-time snapshot. The revision number of the repo does that for you.
让我们变得更简单:
创建项目结构的推荐方法:
永远不要提交标签(可以,但不应该)。
如果您需要开发一些东西而不破坏其他人的工作,请创建一个分支,然后将您的分支与主干合并,但要小心:)
Let's make is simpler:
Recommended way to create your project structure:
Never commit over tag (you can but you shouldn't).
If you have need to develop somenthing without destroying someone else work, create a branch, then merge your branch with the trunk, but take care :)