Search code examples
tfstfs-power-tools

Undo unchanged pending changes with Tfs power tools not working


Using Tfs 2015, when running the following command in my dev folder:

tfpt uu \ noget \recursive

it tells me: There are no redundant pending changes, although in my workspaces there are 15 files in pending changes without changes at all.

Does anyone know what the command is not working for me?


Solution

  • Specifically regarding your example scenario - one quirk is that the direction of your slashes aka in your example you're using backslashes instead of forward slashes doesn't work as expected.

    I tested your scenario specifically and can simulate your result when using back-slashes when trying the cases below.

    EDIT: TEST RESULT OP SCENARIO

    Visual Studio 2015 Enterprise (version: 14.0.23107.0 D14REL)

    TFS Powertools 2015 (version 14.0.23206.0)

    1. WITH FORWARD SLASHES /
    D:\src\testapp\src1>tfpt uu /recursive /noget
    Getting the list of pending changes for your workspace...
    Building the list of redundant changes...
     edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
    Do you wish to undo these redundant pending changes? (Y/N) n
    Operation canceled.
    
    1. WITH BACK SLASHES \
    D:\src\testapp\src1>tfpt uu \recursive \noget
    Bringing the specified items up to the latest version…
    Getting the list of pending changes for your workspace...
    There are no redundant pending changes.
    
    1. AGAIN WITH FORWARD SLASHES /
    D:\src\testapp\src1>tfpt uu /recursive /noget
    Getting the list of pending changes for your workspace...
    Building the list of redundant changes...
     edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
    Do you wish to undo these redundant pending changes? (Y/N) y
    Undoing redundant changes...
    edit: file_with_pending_change.txt
    1 changes undone.
    

    EDIT 2: THE OP PROBLEM.. In the comments on this answer I suggested that the OP deletes TFS cache in order to start from a known baseline state since after testing my solution it and not getting the anticipated result it appeared that this was indeed a corrupted workspace state issue.

    Deleting the cache can be done by closing one's IDE and deleting the files in

    C:\Users\USERNAME\AppData\Local\Microsoft\Team Foundation\XXXX\Cache
    

    Then opening the IDE again and checking if the ghost pending changes still appear. In a case where the pending changes do still appear I would suggest shelving or committing changes one wants to keep and deleting the workspace.

    ADDITIONAL NOTES ON TFPT: If the tfpt working path is not in a mapped workspace path the tfpt command will result in the message specified -

    example:

    I have a server path entitled:

    $/serverpath/testapp/src1

    I have that path mapped locally to:

    D:\src\testapp\src1

    to simulate I then explicitly check out a text file in the src1 for edit.

    tfpt uu /recursive /noget executed from D:\src\testapp results in

    Bringing the specified items up to the latest version... 
    Getting the list of pending changes for your workspace... 
    There are no redundant pending changes.
    

    tfpt uu /recursive /noget executed from D:\src\testapp\src1 results in

    Getting the list of pending changes for your workspace...
    Building the list of redundant changes...
     edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
    Do you wish to undo these redundant pending changes? (Y/N) y
    Undoing redundant changes... 
    edit: file_with_pending_change.txt
    1 changes undone.
    

    Related Note:

    You can also run the standard TF command although you'll be adding the path explicitly for TF.exe to execute against:

    tf undo /recursive D:\src\testapp\src1

    which results in:

    Undoing edit: file_with_pending_change.txt