TFS get command erroneously returns “All files are

2019-02-11 14:15发布

We are just in the process of migrating our TFS repo to Mercurial as we've had enough of TFS. Unfortunately TFS has thrown us one last curve ball before it lets us go. We've wrote a script that we intend to have "get" each changeset (including timestamp, check-in comment etc) and then add them to the Mercurial repo and check it in.

Unfortunately TFS is acting very strange when we execute the tf get * /version:C111 /overwrite command. It immediately returns "All files are up to date." But this is impossible. The workspace folder is empty! And viewing the details for the 111 changeset quite clearly shows that the changeset contains "stuff" i.e. the repo is certainly not empty.

What could be causing this?

标签: tfs
12条回答
你好瞎i
2楼-- · 2019-02-11 15:01

I tried with /force, /recursive, /all options and still had the problem ("All files are up to date.") Eventually I realized the problem was due to mapping. So I deleted mapping and recreated.

My old mapping (incorrect) was done with a wildcard:

tf workfold $/* C:\DEV

So when I listed work folders (tf workspaces /format:detailed) it showed up like this:

Working folders:

  $//*: C:\DEV

When I remapped as below, the get command started working:

tf workfold $/ C:\DEV

and the mapping was showing like this:

Working folders:

  $/: C:\DEV
查看更多
太酷不给撩
3楼-- · 2019-02-11 15:02

I've had this same issue before, and after pulling my hair out, the only thing that corrected it for us was to un-map the workspace, delete all the local files, and then remap the workspace to disk - TFS would finally get a fresh copy of the files then.

We were using TFS 2005, for what it's worth - I'd be sad to hear that this situation still arises with newer versions. If you find another solution, please post it here, as I'd love to know how you resolved it.

查看更多
霸刀☆藐视天下
4楼-- · 2019-02-11 15:03

Choose a date in future to get specific:

tf get * /version:D01/01/2099 /recursive /force  /noprompt
查看更多
Luminary・发光体
5楼-- · 2019-02-11 15:04

It looks like there are multiple ways to trigger this issue. In my case it was dealing with passing a relative path to a script that generated an absolute path and then passed that path to tf.exe. This is a Windows scripting problem more than anything else, but output from tf.exe is confusing.

Really what you'd like to see tfs return is "File not Found" instead of "All files are up to date".

In addition to the other suggestions made here, also double-check what you're passing to tf.exe by re-writing the command with echo first. If you're coming from a unix/linux background, string building just seems broken on win32.

broken.bat

SET PARAM1=%1
SET CMD_PATH="c:\path\to\%PARAM1%"
echo %CMD_PATH%

Result: broken.bat "tool.exe" => "c:\path\to\"tool.exe""

fixed.bat

SET PARAM1=%1
REM Strip quotes: http://www.dostips.com/DtTipsStringManipulation.php
for /f "useback tokens=*" %%x in ('%PARAM1%') do set PARAM1=%%~x
SET CMD_PATH="c:\path\to\%PARAM1%"
echo %CMD_PATH%

Result: fixed.bat "tool.exe" => "c:\path\to\tool.exe"

查看更多
【Aperson】
6楼-- · 2019-02-11 15:05

Instead of "Get latest version", you can "Get specific version" of type "Latest version" and check the "Overwrite all files even if the local version matches the specified version" checkbox. That will force a get latest.

查看更多
smile是对你的礼貌
7楼-- · 2019-02-11 15:07

You can always add the "/force" parameter to TF GET to force it to get all files regardless of what it thinks you have in your local workspace (it maintains the versions of all of your workspace files on the server).

查看更多
登录 后发表回答