TFS 프로젝트의 (tf destroy
) 가지를 찾아서 삭제하는 내장 된 방법이 있는데, 이는 오랫동안 비활성 상태였습니다. 어느 tfs 도구 또는 아마도 그것을 할 수있는 SQL 스크립트는 괜찮을 것입니다.비활성 tfs 분기를 찾아 삭제하십시오.
0
A
답변
0
음, 모든 것은 여기에 코드를 게시, 누군가가 도움이 될 수도, 어렵지 않았다 :
private static string _tfLocation; //location of tf.exe
private static string _tfProject; //our team project
static void Main(string[] args)
{
_tfLocation = ConfigurationManager.AppSettings.Get("tfLocation");
_tfProject = ConfigurationManager.AppSettings.Get("tfProject");
var keepAliveBranches = ConfigurationManager.AppSettings.Get("keepAliveBranches").Split(',').ToList(); //branches that we keep anyway
var latestDate = DateTime.Now.AddMonths(-3); //we delete all branches that are older than 3 months
var folders = ExecuteCommand(string.Format("dir /folders \"{0}\"", _tfProject));
var branches = folders.Split('\r', '\n').ToList();
branches = branches.Where(b => !string.IsNullOrEmpty(b) && b.StartsWith("$")).Select(b => b.Remove(0, 1)).Skip(1).ToList();
branches.ForEach(b => b = b.Remove(0, 1));
foreach (var branch in branches)
{
if (keepAliveBranches.Contains(branch))
continue;
//get latest changeset
var lastChangeset = ExecuteCommand(string.Format("history \"{0}/{1}\" /recursive /stopafter:1 /format:brief /sort:descending /noprompt", _tfProject, branch));
var changesetDate = DateTime.Parse(Regex.Match(lastChangeset, @"\d{2}\.\d{2}\.\d{4}").Value); //get it's date
if (changesetDate < latestDate)
//destroy
ExecuteCommand(string.Format("destroy \"{0}/{1}\" /recursive /stopafter:1 /startcleanup /noprompt /silent", _tfProject, branch));
}
}
//execute console command and get results
private static string ExecuteCommand(string command)
{
var process = new Process()
{
StartInfo = new ProcessStartInfo(_tfLocation)
{
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true,
Arguments = command
},
};
process.Start();
var result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}
2
1
사용하지 않는 분기에는 요소 수정 기록이 포함되어 있습니다. 사용하지 않는 분기는 분기를 writelock으로 삭제하고 떠나야합니다. 복구 된 공간은 중요하지 않습니다.
관련 문제
- 1. TFS 분기를 다운로드하지 않고 삭제하십시오.
- 2. #if 지시문은 XCode의 비활성 분기를 회색으로 표시합니다.
- 3. 디렉토리 내의 파일을 찾아 그 디렉토리를 삭제하십시오
- 4. TFS postbuild 스크립트에서 현재 분기를 얻는 방법
- 5. git tfs로 두 개의 TFS 분기를 합치십시오
- 6. TFS : 분기를 차단/제한하여 주에서 병합하는 방법?
- 7. TFS/Codeplex에서 호스팅되는 프로젝트에 분기를 만들려면 어떻게해야합니까?
- 8. TFS 2010의 모든 하위 분기를 병합합니다.
- 9. TFS 분기를 기반으로 WorkItem을 쿼리하는 방법
- 10. tfs 분기를 이동시키는 스크립트는 어떻게 만듭니 까?
- 11. 원격 svn 분기를 삭제하지 않고 -rD를 사용하여 git 브랜치를 삭제하십시오.
- 12. Excel에서 검색 열을 선택하고 값을 찾아 선택하고 삭제하십시오.
- 13. TFS 2010, VS 2010 및 분기를 폴더로 변환
- 14. TFS 2010에서 프로그래밍 방식으로 항목 분기를 결정하는 중
- 15. TFS 두 개의 개발 분기를 함께 병합하는 방법은 무엇입니까?
- 16. Visual Studio에서 현재 TFS 분기를 명확하게 표시하는 방법이 있습니까?
- 17. C# tfs 병합 변경 집합의 원본 분기를 찾는 방법은 무엇입니까?
- 18. 실수로 배치 된 TFS 분기를 어떻게 이동할 수 있습니까?
- 19. git-tfs 복제 작업에서 특정 분기를 제외하는 방법
- 20. TFS 2008 changeset가 병합 된 분기를 어떻게 확인할 수 있습니까?
- 21. 게시 할 때 TFS 분기를 만들 수 있습니까?
- 22. TFS - 파일을 병합 할 때 대상 분기를 볼 수 없습니다.
- 23. TFS 2012 : 모든 하위 분기를 한 번에 병합
- 24. TFS 재실행 병합
- 25. 찾아
- 26. 찾아
- 27. 찾아
- 28. 레이블 TF10169의 TFS 2010 분기 오류
- 29. 관리 목적으로 지점, 아카이브를 삭제하십시오.
- 30. 모드 라인에서 분기를 숨기시겠습니까?
대답은 긍정적이다,하지만 노력의 비트가 동작하는 예제를 설정하는 것입니다. –
예, 일부 API를 사용하여 Warehouse 데이터베이스에 대해 SSRS를 사용할 수 있습니다. BI 개발자가 설정 했으므로 API 쿼리 이외의 세부 사항은 없습니다. 그러나 Main에 병합하기 전에 변경 내역에 대해 정말로 신경 쓰지 않는다면 tf destroy를 사용할 때주의해야합니다. – DaveShaw