4

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.

Søren Randrup
  • 318
  • 2
  • 19
  • It's not particularly clear what you mean here. "What I want is to undo all the files that was unchanged in my workspace" - if they're *unchanged* in your workspace then what does 'undo' mean? – AakashM Sep 20 '11 at 10:52
  • 3
    Files can be checked out and unchanged. Undo means reverting the checkout. – Søren Randrup Sep 20 '11 at 14:32

5 Answers5

5

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

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Buck Hodges
  • 3,342
  • 1
  • 19
  • 20
  • tftp uu /noget has the same problem. The file A (see example above) is not revertet from checkout in ws1, when using this option. – Søren Randrup Sep 21 '11 at 18:49
2

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.

Yossarian21
  • 149
  • 1
  • 4
0

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
grizzly
  • 1,146
  • 12
  • 26
0

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.

ctb
  • 1,212
  • 1
  • 11
  • 24
0

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.

Elaskanator
  • 1,135
  • 10
  • 28