TFS cannot rollback: "The item being rolled back has changed in a later version" - visual-studio-2012

The Scenario
I want to rollback a changeset.
The Problem
When I perform Rollback Entire Changeset from my $/SAM/Main branch using the VS2012 IDE, the Resolve Conflicts tab displays, and ALL of the files I'm trying to rollback have the following message associated with them:
The item being rolled back has changed in a later version
Changes being rolled back: 54460~54460 Your workspace version is: 54460
You have a pending change on the item
At this point, the only option available to me in the Resolve Conflicts tab is an Undo Rollback button.
Things to Note
CS54460 was created using the following command line:
merge $/SAM/Dev $/SAM/Main /discard /recursive /version:C54426~C54426
CS54460, when viewing the Changeset Details, performs a [merge, branch, delete] on ALL the files.
Why I Need to Do This
I need to do this, because I need to merge CS54426 from the $/SAM/Dev branch up to the $/SAM/Main branch.

Don't use rollback, just do it manually:
get the version you want to roll back to
back up the changed files
check out the changed files. If you're lucky the old code will be preserved but the checkout may force you back to the newest version.
so if necessary copy the backups over the master source files again
test and check in

My problem was solved by using the following command:
merge $/SAM/Dev $/SAM/Main /recursive **/force** /version:C54426~C54426
This forced the changeset I needed in $/SAM/Dev to disregard the "Keep Yours" changeset in $/SAM/Main, thus merging the code I needed up to the $/SAM/Main branch.

I was getting the error "TF203051: Cannot rollback item XYZ because the workspace version of the item is at or older than the version to which you are trying to rollback to. Update the version in your workspace to a newer version than the version to which you are trying to rollback to and then retry your operation." when attempting to roll back to a specific version in the history in VS2017.
The problem was that file XYZ, one of the files was included in multiple changesets, a second one was more recent than the one I was trying to roll back.
Luckily I needed to roll back that too. So the solution was to roll back both versions at the same time by selecting them together in the history view of Source Control Explorer.

Related

Get specific Version from Source control

I have 34 word templates in TFS and I'm suing VS2012.
Only 32 have been modified and saved under a change set.
I wanted to just extract those modified by that change set.
I made sure my mapped folder was empty before I started.
I used Advanced/Get Specific and then did a get using the changeset number
However, all 34 templates were downloaded into my folder.
The changeset get seems to get all files modified before and up to the change set I requested.
In my case I can pick out the 2 files and remove them. But if I had hundreds of files spread over a dozen folder it would be a nightmare.
Is there a way to get only those files modified by a specific changeset files ?
"Get Specific" means getting all the files as how they were at the time when ChangeSet was created. It doesn't mean getting only changed files.
Since you are using VS 2012, you could use Team Foundation Power Tools' tfpt GetCS command:
The GetCS tool retrieves all items listed in a changeset for a
given changeset version.
This is useful when a co-worker checks in a change that you need to
have in your workspace, but you cannot upgrade your entire workspace
to the latest version. Use the GetCS tool to get just the items
affected by your co-worker’s changeset. You can do this without
inspecting the changeset to manually list the changed files when using
a getcs command.
There is no graphical user interface for the GetCS tool. To invoke
the GetCS, type the following command. The parameter
changesetnum specifies the changeset number.
tfpt GetCS /changeset:changesetnum

Android Studio keeps pulling the same items and does not push

I have a problem in pulling item from my repository.
I commit with vcs my changes, then pull the modified items and then I would like to push my changes. The problem is that when I pulled the first time, android studio notified that 2 items were changed; then I've tried to push, and it told me that the push of current branch was rejected and that remotes changes need to be merged. I then chose merge, but an error in merging appeared and it couldn't push anything ("fatal:You have not concluded your merge(MERGE_HEAD exists)").
I've tried several times to pull again and it pulls always the same 2 items (when, after the first time, it had to tell me that no items were pulled since I've already pulled them).
What can I do?
I am sure that you do not need the information now but I'll respond because it is here -
From what I can see, when you first pulled the changes there were merge conflicts (that is, the merge was not completed).
So, when you pull again without resolving the conflicts the same error will show up again and again.
You will have to abort the merge using I ran into a merge conflict. How can I abort the merge? and then perform the merge again(once the merge is completed you can continue with the other pull operations).

Perforce to ignore revision during integrations

I have created feature branch for one of our projects, and deleted all documentation files there in one changelist. (I know, bad idea).
I want to integrate back everything except given changelist, I tried following to ignore it:
p4 integrate //branch/...#CL,CL //main/...
p4 resolve -at //main/...
However, the files still remain marked for deletion - the resolve ends with
//main/... - no file(s) to resolver.
Is there any way how to tell perforce that given CL is already integrated and ignore it in subsequent integrations?
Note that you need at least a 2011.1 server to do this (if your server is older you'll get an error message on the integrate):
p4 integrate -Rd //branch/...#CL,CL //main/...
p4 resolve -ay
The "-Rd" flag says that files which would normally be opened for delete automatically should be opened for integrate and scheduled for resolve instead. In turn, the "p4 resolve -ay" will say that you want to keep what's in your workspace (an "integrate" with no content change) and submit that as the final result.
The submitted "integrate" revisions will record that you have done this integration (the history will show an "ignore" of the deleted revisions in your branch), but without actually changing the contents of the submitted files.
If you use the "p4 merge" command instead of the "p4 integrate" command (with a more current server version, I think 2013.1 or thereabouts), all files are scheduled for resolve automatically (i.e. including those that would previously have been automatically opened for branch or delete), so with "p4 merge" you always must resolve (and may optionally ignore) any source change.
Relevant p4 blog entries:
http://www.perforce.com/blog/110620/ignoring-branches-deletes
http://www.perforce.com/blog/130812/resolve-face-adversity
It seems like you wanted 'resolve -ay' here, not 'resolve -at'. When integrating back to main, I think that "theirs" is the branch, while "yours" is main.
From 'p4 help resolve':
The resolve process is a classic three-way merge. The participating
files are referred to as follows:
'yours' The target file open in the client workspace
'theirs' The source file in the depot
'base' The common ancestor; the highest revision of the
source file already accounted for in the target.
'merged' The merged result.
Filenames, filetypes, and text file content can be resolved by
accepting 'yours', 'theirs', or 'merged'. Branching, deletion, and
binary file content can be resolved by accepting either 'yours' or
'theirs'.

Modify .csproj in pre-build event

tl;dr: How to modify the .csproj file during publishing with ClickOnce while executing pre-build events?
Long:
I'm using TFS hosted by Microsoft for version control of my solution.
When publishing with ClickOnce, I get the latest revision number + 1 without problems. I also can successfully write the new version number into the .csproj file outside my build-process.
The problem is, that the .csproj file doesn't get updated during the build process - it might be in a write-lock. I get a notification inside Notepad++ about the modification of the file, but the file still contains the old version and VS didn't notice any changes.
The only solution by now I found to resolve this issue:
Move the revision update into the post-build events and add 2 instead of one to the actual revision number. Unfortunately this would cause that revision number would be out of date whenever other developers check-in code.
Ok, strike that... :(.
After some more diffing, you'll need to override the GenerateApplicationManifest target to get this to work. That target doesn't use a *DependsUpon propertygroup, so it's harder to overwrite. The whole flow is defined in the Microsoft.Common.Targets file which you can find in the %windir%\Microsoft.NET\Framework{cpu}\{version} folder.
See also:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3a94df52-74c1-4fca-a830-ab530ec49207/use-msbuild-to-create-clickonce-app-files-in-alternate-location

Cannot integrate change using perforce

I am trying to integrate a change list from one branch of code to another branch.For this I do
1)p4 integ old_branch#cl,cl new_branch
2)p4 resolve -am
3)p4 change.
Now when I am doing the last part(p4 change ) I see this error :-
The document “tmp.BLAH BLAH” could not be opened. You don’t have
permission.
Has anyone seen this before and can help me correct this?I do have the config file under the branch's root
I was using P4V with Perforce when I had to use it. Drastically helped me with merges considering P4 is not quite like using SVN or Git.
Also I think that if the file can be removed from your filesystem you can revert to the latest from the repository if in fact it is a file from the repository. Then you can retry your merge.
I know in other merge programs the tmp files are generated during the conflict resolution process so you may be facing a similar issue.

Resources