你為什么不做一個標簽呢?

[英]Why shouldn't you commit on a tag


I'm looking for arguments to convince an customer that he should never commit changes to a tag once it is created.

我正在尋找說服客戶的理由,即一旦創建了標簽,他就不應該對其進行更改。

Common sense appears to be no valid argument so I need something more substantial.

常識似乎不是有效的論點,所以我需要更實質性的東西。

6 个解决方案

#1


24  

Tags exist as copies of the sourcecode at a fixed point in time - regardless of whatever changes you might make to the Trunk or any Branch folders, you'll always be able to go back to the code as it was when the tag copy was created.

標記作為源代碼的副本存在於一個固定的時間點——不管您對主干或任何分支文件夾做了什么更改,您將始終能夠回到代碼,就像在創建標記副本時一樣。

If you're committing to tagged copies, they no longer represent the source at the point the copy was created - so there's little point having them. Your client should be committing to the trunk, or to branches.

如果您要提交帶有標記的副本,那么在創建副本時,它們不再表示源文件,因此,擁有它們是沒有意義的。您的客戶機應該提交到主干或分支。

#2


4  

Users who are using the project may be using a certain tagged version of your code. They know their code works with the tag you've specified and will happily release based on this assumption. If you change the tag, then the user's code may break. A tag is literally that - it is a stable milestone on which other user's can consider set in stone.

使用該項目的用戶可能正在使用您的代碼的特定標記版本。他們知道他們的代碼與您指定的標記一起工作,並將基於這個假設愉快地發布。如果您更改了標記,則用戶的代碼可能會中斷。標簽字面上是這樣的——它是一個穩定的里程碑,其他用戶可以在上面考慮設置在石頭上。

Also, if there is more than one developer on the project, they'll be working on trunk. When they update, they won't get the changes that were made on the tag which will cause a huge merge problem.

另外,如果項目中有不止一個開發人員,他們將在主干上工作。當它們更新時,它們不會得到標記上的更改,這將導致一個巨大的合並問題。

#3


2  

Tag should point to some existing revision in time. You're basically giving this revision a name, i.e. tag. In SVN, tag is just a copy in /tags directory, so commiting is possible, but that's just an implementation detail. Nothing prevents you from commiting, but it's unusual, and people using the tag may be confused what exactly this tag represent ... original revision when tag was created or new changes. In the end, it's all about communicating your intent.

標記應該指向一些現有的修改時間。你基本上是給這個修訂版一個名字,也就是標簽。在SVN中,標記只是/tags目錄中的一個副本,所以提交是可能的,但這只是實現的細節。沒有什么能阻止你做出承諾,但這很不尋常,使用標簽的人可能會混淆這個標簽代表的是什么……創建標記或新更改時的原始修訂。最后,一切都是為了傳達你的意圖。

In other systems, tags are just pointers to specific revision. You can create new branch from tagged revision, but tag remains pointing to original revision.

在其他系統中,標簽只是指向特定修訂的指針。您可以從標記的修訂創建新的分支,但是標記仍然指向原始的修訂。

#4


2  

When tagging a version, it can be hard to predict if you will later need to go back to that version and make changes. Sometimes you wish you had made a branch instead of just a tag, but most of times a branch is overkill.

當給一個版本添加標簽時,很難預測你以后是否需要回到那個版本並做出改變。有時候你希望自己做了一個分支而不是一個標簽,但是大多數時候一個分支是過度的。

Maybe you can convince your customer to take another approach, between committing on a tag and make a branch (which a lot of people fear).

也許你可以說服你的客戶采取另一種方法,在做一個標簽和做一個分支(這是很多人害怕的)。

First make a local copy of a tag, then make the necessary changes (locally), and commit the result as a new tag. If the new version requires several commits, you can give the new tag a draft name—just to make sure no one mistakes this tag for a finished version—and when all commits are made, rename the new tag to a final name. (I believe SVN allows renaming tags, although I've never done it.)

首先創建一個標記的本地副本,然后進行必要的更改(本地),並將結果作為一個新標記提交。如果新版本需要幾個提交,那么您可以給新標簽一個草案名稱——只是為了確保沒有人錯誤地將此標記用於完成的版本——當所有提交都完成時,將新標記重命名為最終名稱。(我相信SVN允許重命名標簽,盡管我從來沒有這樣做過。)

#5


1  

Old post, but as other might still read it I'll add my two cents:

以前的帖子,但是其他的人可能還會讀,我會加上我的兩美分:

Previous answers all rely on the common sense you say the client is not responding to. Try this story instead: "A tag is like taking a family picture at a wedding. You wouldn't pull out your permanent marker to add aunt Lisa to the picture, would you? If you want to paint, use a piece of paper instead. (=branch)"

以前的答案都依賴於你所說的客戶沒有回應的常識。試試這個故事吧:“一個標簽就像在婚禮上拍一張全家福。”你不會拿出你的永久標記把麗莎阿姨添加到照片里,對嗎?如果你想畫畫,用一張紙代替。(=分支)”

As a side note it'd be interesting to know why the customer wants to commit to the tag. I find it much easier to argue when knowing what the counterpart is trying to achieve, and the needs behind that.

順便說一下,了解客戶為什么要提交標簽是很有趣的。我發現,當知道對方想要達到什么目標,以及背后的需求時,爭論起來會容易得多。

#6


-1  

Ok.. what if you've got brilliant co-workers who make tags that are seriously bloated versions of the code, full of temp files, etc., that are absolutely unnecessary?! I think removing the junk and committing back to the tag is fine.. as long as there is a comment about it (comment will have timestamps, and I assume any change to a tag will also have a timestamp, so pretty easy to look for comments from around that time). Of course, if you're a big company, or a seriously professional, well-structured and red-taped (we're nowhere near this), then it is a different story.

好吧. .如果你有出色的同事,他們制作的標簽是非常臃腫的代碼版本,充斥着臨時文件,等等,那是絕對沒有必要的?我認為清除垃圾並返回標簽是可以的。只要有關於它的注釋(注釋將有時間戳,並且我認為對標記的任何更改也會有一個時間戳,所以很容易在那個時候查看注釋)。當然,如果你是一家大公司,或者是一個專業的、結構良好的、紅的(我們離這很近),那就另當別論了。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/04/07/729e5a548b573564943d75e43bead78c.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com