开发者

TFS discard not working on rollback changesets

开发者 https://www.devze.com 2023-04-06 01:47 出处:网络
We have a situation where work had been done in the trunk of our system but was then pulled for our next release. We created a branch with the changes still in the trunk and then rolled back the chang

We have a situation where work had been done in the trunk of our system but was then pulled for our next release. We created a branch with the changes still in the trunk and then rolled back the changes in the trunk only.

What that's left us with though is that whenever we want to update the branch with recent work from working, it tries to merge the rollback changesets which we don't want.

I've tried using the /discard command from the TFS command prompt but keep getting "There are no changes to merge". Here is my syntax below:

D:\Projects\Big Project\Trunk>tf merge /discard /version:C28350~C28350 /recursive "D:\Projects\Big Project\Trunk" "D:\Projects\Big Project\Branch"

I even tried switching around the source and the destination to no avail :)

The changes开发者_开发百科et appears in the list of candidate changesets for the potential merge from trunk to branch. There have been a few checkins to the working branch since the initial branching but none to the branch.

Does anyone have experience with the discard command and why it may not be working here??

Thanks for your suggestions


Reading through tf rollback MSDN the option /keepmergehistory is there exactly for these scenarios. (Please see the relevant example at the end of the help doco).

Your scenario is different, here are the steps I would follow (command prompt omitted):

tf merge /version:C28350~C28350 /recursive "D:\Projects\Big Project\Trunk" "D:\Projects\Big Project\Branch"

tf checkin /recursive "D:\Projects\Big Project\Branch"

tf rollback /version:XXXX /recursive /keepmergehistory "D:\Projects\Big Project\Branch"

Comments about the steps:

  1. Without the /discard option

  2. Check that change in, even though you're not interested in it; note the changeset number for the XXXX in the next step...

  3. Now rollback that particular change, and use /keepmergehistory so that TFS won't ever ask you again about merging this change.

Alternatively, you should be able to rollback the rollback in the trunk, then re-apply with this flag - but I'm not sure the /keepmergehistory works both ways.. here goes: (not sure I put the parameters there correctly...)

tf rollback /version:C28350 /toversion:C28349 /recursive "D:\Projects\Big Project\Trunk"

tf rollback /version:XXXX /toversion:XXXX-1 /recursive /keepmergehistory "D:\Projects\Big Project\Trunk"

Hope this helps :-)


This can be accomplished by telling TFS to ignore history while performing the merge. In other words, it can be done using a baseless merge:

D:\Projects\Big Project\Trunk>tf merge /discard /version:C28350~C28350 /recursive /baseless "D:\Projects\Big Project\Trunk" "D:\Projects\Big Project\Branch"

0

精彩评论

暂无评论...
验证码 换一张
取 消