TFS : 배치 파일에서 수정되지 않은 파일의 체크 아웃을 실행 취소하는 방법
배치 파일을 사용하여 코드를 생성하고 TFS (Team Foundation Server)에서 생성 된 파일을 자동으로 체크 아웃하여 파일을 재생성 할 수 있습니다. 이러한 파일의 대부분은 수정되지 않지만 생성기는이를 미리 알지 못합니다.
"tfs undo"명령은 체크 아웃을 취소하지만 일부가 수정되었는지 (우리가 원하지 않는) 프롬프트를 표시합니다. 또한 생성 된 파일을 즉시 체크인하고 싶지 않습니다.
사용자에게 프롬프트하지 않고 수정되지 않은 모든 파일의 체크 아웃을 취소하는 명령 (또는 일련의 명령)이 있습니까?
2011 년 8 월 Team Foundation Server Power Tools 의 Undo Unchanged 명령을 살펴보십시오.
c:\myProject> tfpt uu . /noget /recursive
링크 업데이트를위한 Matt Florence에게 감사합니다.
실제 구문에 대해 Ray Vega에게 감사드립니다 .
Team Foundation Server Power Tools를 설치 하고 프로젝트 작업 공간 디렉토리의 루트에있는 tfpt.exe를 사용하여 명령 행에서 다음을 실행하십시오.
c:\myProject> tfpt uu . /noget /recursive
포함 /noget
은 전체 수에 따라 시간이 오래 걸릴 수있는 모든 프로젝트 파일의 '최신 정보 얻기'를 방지하므로 적극 권장됩니다.
@mike & @ray 감사합니다.
더 쉽게 만들고 싶습니다.
VS의 도구 메뉴에서 "외부 도구"를 클릭하십시오.
추가를 클릭하십시오.
제목을 입력하십시오.
명령 : tfpt.exe
인수 : uu / noget / 재귀
초기 디렉토리 : [화살표 버튼에서 선택할 수 있습니다].
도구 메뉴에 두 개의 새로운 명령이 추가되었습니다.
필요할 때 사용하십시오.
즐겨,
Ofir
- 프로젝트를 마우스 오른쪽 버튼으로 클릭
- 결제 취소를 선택한 다음 확인을 클릭하거나 확인이 남아있는 경우 ...
- Then, while undoing checkout, for every file that has REAL changes in it, a prompt will ask you to confirm the check out for that file... simply click "No to All"
Visual studio will know if the checked out file has changes or none.
WARNING: This method also removes new files, i.e. files that are not yet checked in to TFS. If you want to keep these files then simply exclude them from the set of files you "undo".
Updated this question with an answer when working with TFS2017 and VS2017/VS2019 only.
The power tools does not exist for TFS 2017 and the old ones can't work well together with it, but apparently most of the functionality has been moved to VS2017 itself or plugins (see below).
Visual Studio 2017/2019 Extension
Some actions like undo unchanged files have moved to an
"Undo Unchanged" button location:
Known bug
You have to open the 'Source Control Explorer' (and leave it open) so that the 'Undo Unchanged' is displayed in the Action menu of the Pending Changes view. reported here.
Windows Shell Integration Extension
Also, you can still set up Windows shell integration through an separate installer which is no longer linked to TFS Power Tools.
The windows shell integration do not work exactly the same as the powertools before, but the most important actions worked for me.
If you simply check all the files back in again that you checked out, TFS is smart enough to figure out which ones changes and only include them in the changeset that is recorded on the server.
TFS does this by comparing MD5 hashes of the files contents before and after check-in.
This is all assuming that your generation process is purely updating the same set of files, i.e. you will never have the case where a file that was generated in a previous generation is not needed in the next generation (i.e. you would want to pend a delete for that file) or that the files change name.
If your process could potentially need files deleting, the your best bet might be to look at the Team Foundation Power Tools command (tfpt) and use the tfpt online command that will only check out the files that have changed, and will be smart enough to pend deletes for any files that are no longer needed or changed name and pend adds.
Good luck,
Martin.
Beware that TFS undo will not revert back the File System's "Date Modified" value. This is very frustrating especially if you use tools like robocopy to sync up remote machines. Even after you undo your check out, if you saved the file thereby updaing the "Date Modified" value, that updated value will stick around even after an undo checkout.
There are a couple of points regarding the uu option for tfpt (recommended in most of the other answers) that were not clear to me at first. Firstly, this is the command line help that can be accessed with the command tfpt uu /?
Undoes redundant pending changes. If the state of an item with a pending change is the same as on the server, then the change is undone.
Usage: tfpt uu [/changeset:changesetnum] [/recursive] [/noget] [filespec...]
- /changeset Compare the workspace to item states at the changeset version specified instead of the latest version
- filespec... Only check the listed filespecs for redundant changes
- /recursive Check the specified filespecs with full recursion
- /noget Do not run get before checking
The /changeset option may not be used with filespecs or /recursive.
Now let me break down the command that is recommended in the other answers.
tfpt uu . /noget /recursive
tfpt uu
specifies that we wish to use the 'Undo Unchanged' command..
indicates (I guess) that the current working directory should be used as the filespec./noget
ensures that 'get latest version' is not called before undoing the unchanged files./recursive
ensures that not just the filespec will be considered but all recursive child folders and files. This seems to be dependent on the filespec - if there is none provided then the whole workspace is processed.
So there are a couple of things to note here regarding the command from above...
- It is dependent on the working directory.
- It does not process the entire workspace.
I have found that the following command works best for me - it will process the entire workspace.
tfpt uu /noget
Note that it is still dependent on the working directory in that tfpt uses it to determine which workspace should be processed. But as long as you provide a path to a file or folder within the workspace, you are good to go.
I can see Ray LionFang's approach above. Can't comment there since I don't have the rep. While I like this approach since there's no changes required to Tools etc........
- Right-click on your project
- select undo checkout, then just click okay, or whatever confirmation is left...
- then, while undoing checkout, for every file that has REAL changes in it, a prompt will ask you to confirm the check out for that file... simply click "No to All"
- Visual studio will know if the checked out file has changes or none. Be aware that this method also removes added files that are not yet checked in from TFS...
.......there's a problem with that approach in that hitting "No To All" retains a few files which are not modified. It seems to do something like Undoing unmodified files until it hits the first file that's actually modified and then ignores the rest of the unmodified files, if that makes any sense. I've only seen this effect once in a while.
A potential work-around is to follow the above process but instead of hitting "No To All", hit "No" for each file. Since this can take a while depending on the number of files you're working with, what I normally do is to hold down "ALT + N", and it just speeds through all the files while undoing ALL unmodified files.
내가 아는 한, TFS에서 팀 프로젝트를 체크 아웃하면 전체 프로젝트가 체크 아웃되고 어떤 파일이 중단되는지 제어 할 수 없습니다. 특정 파일에 대한 체크인을 방지하려면 해당 파일을 잠글 수 있습니다.
직장에서 우리 모두는 TFS를 싫어합니다.
'Programing' 카테고리의 다른 글
Bash를 사용하여 존재하지 않는 하위 디렉토리를 재귀 적으로 만드는 방법은 무엇입니까? (0) | 2020.05.25 |
---|---|
Eclipse 패키지 탐색기에서 열린 파일을 어떻게 표시합니까? (0) | 2020.05.25 |
TypeScript의 공개 정적 const (0) | 2020.05.25 |
JavaScript 코드를 사용하여 브라우저 너비를 얻는 방법은 무엇입니까? (0) | 2020.05.25 |
Java if 문의 약식 (0) | 2020.05.25 |