Michael Denny's Blog ;]


Tutto quello che non avresti mai voluto sapere sulle Regular Expression...e se sei qui ti tocca!
Archivio Posts
Anno 2017

Anno 2015

Anno 2014

Anno 2013

Anno 2012

Anno 2010

Anno 2008

Anno 2007

[TFS] - Scorch per tenere sincronizzato il disco locale con il source control

Oggi guardando il mio workspace di tfs ho constatato che la sua dimensione era davvero enorme rispetto al reale spazio che avrebbe dovuto avere con un download pulito dei codici sorgenti. Questo ovviamente è dovuto in parte dalle build dei sorgenti nelle varie modalità di rilascio (debug, release, ecc...), ma anche dai vecchi files, branches e progetti, che non sono più presenti sul source control, ma che sono rimasti nel workspace locale perchè alla fine tfs si è dimenticato di rimuoverli per noi.

Per pulire questa situazione ho trovato le "tfs power tools" veramente utili, utilizzando il comando: tfpt scorch

Ecco l'help completo preso dall'eseguibile stesso (versione 2011 per TFS 2010 + SP1):

tfpt scorch - Ensure source control and the local disk are identical

Your local disk will be scanned for:
(1) items that are not in source control
(2) items which are different on disk from the workspace version
(3) items which are in the workspace but are missing on disk

Items not in source control will be deleted from disk, just as with the
tfpt treeclean command. Items determined to be different on disk from the
workspace version will be redownloaded from the server. Items missing on
disk will also be redownloaded. Items with pending changes are exempted.

By default, items deleted from your local disk (#3 above) will not be
scanned for, and local items are determined to be identical/different from
the workspace version *solely by examining the read-only bit on the file*.

To redownload items deleted from your local disk (#3 above), supply the
/deletes option. To detect items which are different from the workspace
version but still have their read-only bit set (+R), supply the /diff option.
When using either or both of these options, tfpt scorch runs more slowly.

Usage: tfpt scorch [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]
[/deletes] [/diff]

/noprompt Do not show the list of items to be deleted and
redownloaded in a dialog box for confirmation
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/deletes Detect and replace items missing from the local disk
/diff Use MD5 hashes to compare items with source control
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed (inclusion list)

Prima di procedere ho messo il mio workspace in una situazione "pulita", non avendo alcun file in checkout, per evitare di perdere alcuna modifica, e poi ho eseguito questo comando:

tfpt scorch /recursive /deletes

L'opzione /recursive esegue un controllo più approfondito non fermandosi al primo livello di ricorsione, ma eseguendo una ricorsione completa.

L'opzione /deletes dice all'utility di controllare anche se ci sono file rimossi dal disco locale che però sono presenti sul source control e ne dispone il download.

Al termine dell'esecuzione del comando, ti verrà chiesto di confermare le azioni che andrà ad eseguire l'utility.


Un altro comando che potete utilizzare per rimuovere soltanto i files che non sono presenti nel version control è il comando treeclean:

tfpt treeclean /recursive

tfpt treeclean - Delete files and folders not under version control

Usage: tfpt treeclean [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]

/noprompt Operate in command-line mode only
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed

Potete scaricare la versione per Team Foundation Server 2010 + SP1 da qui:

http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f

e la versione per TFS 2012 da qui:

http://www.microsoft.com/en-us/download/details.aspx?id=35775


Questa utility mi ha salvato tempo inutile che avrei perso su script di pulizia, e spero anche a voi.

martedì, 19 mar 2013 Ore. 12.35
Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345





Statistiche
  • Views Home Page: 82.310
  • Views Posts: 80.077
  • Views Gallerie: 0
  • n° Posts: 31
  • n° Commenti: 18
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003