为什么签入封闭式搁置集不会影响挂起的更改? [英] Why checking in a gated shelveset does not effect the pending changes?

查看:23
本文介绍了为什么签入封闭式搁置集不会影响挂起的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个几乎空洞的工作流程进行门控签到,只是为了了解内部工作原理.

I am playing with the gated check-ins using an almost empty workflow, just to understand the inner workings.

这是我的场景:

  1. 进行更改.
  2. 签到,触发门控签到 - 工作流程什么都不做.
  3. 前往与门控签到相关的代理并玩一下搁置集 - 见下文.

因此,我创建了一个新文件 (1.txt) 并将其签入.更改记录在新的搁置集中,现在我要去代理并首先确保没有更改并且搁置集可用:

So, I have created a new file (1.txt) and checked it in. The change is recorded in a new shelveset and now I am going to the agent and first make sure that no changes are there and that the shelveset is available:

PS D:\tfs\DFGatedCheckInTest2> tf status /recursive
There are no pending changes.
PS D:\tfs\DFGatedCheckInTest2> dir 1.txt -ErrorAction SilentlyContinue
PS D:\tfs\DFGatedCheckInTest2> tf history ..\..\..\ /version:T /stopafter:1 /recursive /noprompt
Changeset User              Date       Comment
--------- ----------------- ---------- ------------------------------------------------------------------------------------------------------------------------
105631    DAYFORCE\mkhar... 10/24/2014
PS D:\tfs\DFGatedCheckInTest2> tf shelvesets "Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov" /format:detailed
===============================================================================================================================================================
Shelveset: Gated_2014-10-24_12.09.49.4626
Owner    : DAYFORCE\mkharitonov
Date     : Friday, October 24, 2014 12:09:49 AM
Comment  :
  Adding 1.txt
PS D:\tfs\DFGatedCheckInTest2> tf status /shelveset:"Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov"
File name Change User                 Shelveset
--------- ------ -------------------- -------------------------------------------------------------------------------------------------------------------------
$/DFDev/mark
1.txt     add    DAYFORCE\mkharitonov Gated_2014-10-24_12.09.49.4626

1 change(s)

到目前为止一切顺利 - 没有变化,文件不存在并且搁置集已准备就绪.现在我将搁置搁置:

So far so good - no changes, the file does not exist and the shelveset is ready. Now I am unshelving the shelveset:

PS D:\tfs\DFGatedCheckInTest2> tf unshelve "Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov" /noprompt

$/DFDev/mark/1.txt:
   opened for add in CANWS212;DAYFORCE\mkharitonov
Unshelving add: 1.txt
PS D:\tfs\DFGatedCheckInTest2> tf status /recursive
File name Change Local path
--------- ------ ----------------------------------------------------------------------------------------------------------------------------------------------
$/DFDev/mark
1.txt     add    D:\TFS\DFGatedCheckInTest2\1.txt

1 change(s)
PS D:\tfs\DFGatedCheckInTest2> dir 1.txt


    Directory: D:\tfs\DFGatedCheckInTest2


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        10/24/2014  12:16 AM          0 1.txt

同样,一切都如预期般 - status 命令显示了正确的待定更改并创建了新文件.接下来我检查搁置集:

Again, everything is as expected - the status command shows the right pending change and the new file is created. Next I check in the shelveset:

PS D:\tfs\DFGatedCheckInTest2>  tf checkin /shelveset:"Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov" /bypass /force
Changeset #105632 checked in.
PS D:\tfs\DFGatedCheckInTest2> dir 1.txt


    Directory: D:\tfs\DFGatedCheckInTest2


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        10/24/2014  12:16 AM          0 1.txt


PS D:\tfs\DFGatedCheckInTest2> tf history ..\..\..\ /version:T /stopafter:1 /recursive /noprompt
Changeset User              Date       Comment
--------- ----------------- ---------- ------------------------------------------------------------------------------------------------------------------------
105632    DAYFORCE\mkhar... 10/24/2014 Adding 1.txt
PS D:\tfs\DFGatedCheckInTest2> tf shelvesets "Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov" /format:detailed
No shelvesets found matching Gated_2014-10-24_12.09.49.4626;DAYFORCE\mkharitonov
PS D:\tfs\DFGatedCheckInTest2>

看起来不错 - 文件在那里,一个新的变更集被添加到历史记录中,搁置集被删除.

Looks good - the file is there, a new changeset is added to the history and the shelveset is deleted.

然而,这部分我不明白,还有待定的变化:

PS D:\tfs\DFGatedCheckInTest2> tf status /recursive
File name Change Local path
--------- ------ ----------------------------------------------------------------------------------------------------------------------------------------------
$/DFDev/mark
1.txt     add    D:\TFS\DFGatedCheckInTest2\1.txt

1 change(s)

为什么???

我认为摆脱这个待处理更改的唯一方法是撤消并明确获取新的更改集:

The only way I see to get rid of this pending change is undo and get the new changeset explicitly:

PS D:\tfs\DFGatedCheckInTest2> tf undo /noprompt /recursive .
Undoing add: 1.txt
PS D:\tfs\DFGatedCheckInTest2> dir 1.txt -ErrorAction SilentlyContinue


    Directory: D:\tfs\DFGatedCheckInTest2


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        10/24/2014  12:16 AM          0 1.txt


PS D:\tfs\DFGatedCheckInTest2> tf status /recursive /noprompt
There are no pending changes.
PS D:\tfs\DFGatedCheckInTest2> tf status 1.txt
There are no pending changes.
PS D:\tfs\DFGatedCheckInTest2> tf history 1.txt /noprompt
Changeset Change                     User              Date       Comment
--------- -------------------------- ----------------- ---------- ---------------------------------------------------------------------------------------------
105632    add                        DAYFORCE\mkhar... 10/24/2014 Adding 1.txt
PS D:\tfs\DFGatedCheckInTest2> tf get /version:C105632
D:\TFS\DFGatedCheckInTest2:
Getting 1.txt
PS D:\tfs\DFGatedCheckInTest2> dir 1.txt


    Directory: D:\tfs\DFGatedCheckInTest2


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-ar--        10/24/2014  12:44 AM          0 1.txt


PS D:\tfs\DFGatedCheckInTest2>

这里我不明白另一件事.如果我撤消了更改,那么 1.txt 怎么仍然是版本化的?我在这里撤消了什么?

And here I do not understand another thing. If I have undone the change, then how come 1.txt is still versioned? What am I undoing here?

获取新的变更集会重写文件或只是更改其上次修改时间(从上午 12:16 到凌晨 12:44),这同样糟糕.事实上,假设我在 unshelve 之后构建了无数文件.现在它们将在下一次门控检入时再次构建,因为源文件的最后修改时间戳被 tf get 命令增加了.(当然,第二个 tf get/version:C105632 什么都不做)

And getting the new changeset rewrites the file or just changes its last modification time (from 12:16 AM to 12:44 AM), which is equally bad. Indeed, suppose I build a zillion files following the unshelve. Now they will be built again in the next gated check-in, because the last modification timestamps of the source files was bumped up by the tf get command. (A second tf get /version:C105632 does nothing, of course)

这太糟糕了.我一定是把事情搞糊涂了,因为它不可能是这样设计的.

This is awful. I must be confusing things, because it cannot be like this by design.

请向我解释我在这里做错了什么.

Please, explain to me what am I getting wrong here.

推荐答案

这一切都与容器、搁置集和工作区有关.

This is all about containers, shelvesets and workspaces.

  • 您创建文件并将其提交到搁置集(容器 A).
  • 然后您转到构建代理并将该 Shelveset 放入本地工作区(容器 B)
  • 然后提交搁置集(从容器 A 到源代码管理)从Container A签入成功,Container A被删除反映门控货架已经完成了它的生命周期(如果它失败了它会保持完整)
  • 然后您将返回到您的 Agent 工作区(容器 B)没有做任何工作,因为整理文件.

因此,此时您有一个 New 文件,TFS 已将其标记为待处理的 ADD 文件(它尚不存在于源代码管理中(没有其他文件)可以访问它,它只存在于您的工作区(容器 B)中,因为自从从容器 A 签入后您还没有对其进行操作)

So at this point you have a New file that TFS has noted as being a pending ADD of (it doesn't exist in source control yet (no one else can access it, it only exists in your workspace (Container B), as you haven't manipulated it since the checkin from Container A)

撤消文件是删除工作区中文件的 ADD 与从搁置集中提交的文件不同,但现在 TFS 中有一个与该文件同名的文件您在本地工作区(容器 B)中有.所以 TFS 会做它认为正确的事情,并用源代码管理中的文件替换您的本地文件.

Undoing the file is removing the ADD for the file in your Workspace Not the same file that was commited from the shelveset, but now there is a file in TFS with the same name as the one that you have in your local workspace (container B). so TFS does what it thinks is right and replaces your local file with the one from Source Control.

如果您按照标签使用 TFS2010,那么这听起来是正确的,您将使用服务器工作区,因此只会检测到 TFS 已收到通知的更改/挂起编辑.在 2012/2013 年可以使用本地工作区,它可以检测用户在没有通知 TFS 的情况下所做的工作区更改.

If you are working with TFS2010 as per the Tag then this sound correct, you will be working with Server workspaces, so only Changes / pending edits that TFS has been notified of will be detected. In 2012 / 2013 local workspaces can be used which can detect changes in the workspace that have done by the user without TFS being notified.

这篇关于为什么签入封闭式搁置集不会影响挂起的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆