Søren Randrup
Søren Randrup

Reputation: 418

How to revert / undo unchanged files in TFS?

I would like to know if there is a usefull command for undoing unchanged files in TFS.

I have tried with the "tfpt uu" command. But it only undoes/reverts the files that was unchanged on the server and in my local workspace. Eg. all the files that was changed on the server but wasn't touched in the workspace is left as checked out. What I want is to revert/undo all the files that was unchanged in my workspace. The tfpt uu-command seems to be useless for the scenario.

How can i revert/undo unchanged files in TFS, where the definiton of an unchanged file is a file that was not changed in the workspace.

Example:

I have two workspaces ws1 and ws2. Ws2 is for simulating an other user making source changes in TFS and ws1 represents my own workspace. We have 3 files A, B and C.

  1. Checkout all files on ws1. (A, B and C are checked out)
  2. Change file A in ws2.
  3. Check In file A in ws2.
  4. Change file B in ws1.
  5. Execute tfpt uu on ws1.

The only file reverted/undone is C. The files A and B are still checked out in ws1

I would expect that both A and C where reverted/undone, since they have not been changed in ws1.

Upvotes: 4

Views: 4093

Answers (5)

Elaskanator
Elaskanator

Reputation: 1216

Relevant: Date Created/Modified attribute on files appears to make tfpt uu not work, because I manually copy/pasted files from one branch's local directory to another and it refuses to undo anything, even though only a few files have been modified.

In my case, the modification timestamps are the same, but the creation timestamps are off by 10 minutes because that's how long it apparently took me to download the two branches to my local development machine.

Upvotes: 0

ctb
ctb

Reputation: 1222

I ran into a similar situation where I had branched my code, then renamed the branch, and when I went to merge them back together, every file had a "change" because of the rename (physical path changed).

I tried 2 options:

  1. tfpt uu /whatever-options-you-want -- In my particular case, this didn't undo the changes, because I guess they technically were changes?
  2. Another solution I had run across was to undo all pending changes, and then click "No To All" when the warning pops up about undoing changed files. This almost worked, except that it also undid my new file adds.

Since neither of these worked for me, I got tired of looking, but thought maybe one of these options would work for someone else.

Upvotes: 0

grizzly
grizzly

Reputation: 1156

The question is old, but this might help: assuming all your files in your workspace are pointing to the same changeset, you might as well compare agains your working version:

First, get your working version:

tf history . /r /noprompt /stopafter:1 /version:W

Then undo all unchanged files (assuming the previous command returned 123456 as your working version):

tfpt uu /changeset:123456 /recursive

Upvotes: 0

Yossarian21
Yossarian21

Reputation: 189

It sounds like you need to merge/resolve the changes to file A before tfpt uu will recognize that the file is unchanged. Since file A is checked out, TFS expects you to resolve the file before it updates your local copy. So tfpt doesn't recognize that the file has not changed, because it is not the same as the (latest) server version.

Upvotes: 2

Buck Hodges
Buck Hodges

Reputation: 3352

Specify the /noget option on tfpt uu, and I think you will get the behavior you are after.

Upvotes: 5

Related Questions