2011-04-07 15 views
19

Nuestra persona de compilación estaba teniendo problemas para compilar código fuente que está registrado en nuestra instancia de TFS.¿Cómo borrar el conocimiento del servidor TFS de mi versión local?

Estaba trabajando en algunos cambios que no estaba listo para registrar, así que hice una copia de seguridad manual de mi carpeta local y eliminé el contenido de mi carpeta local. Luego hice una "Obtener la última versión específica, con sobreescritura" para asegurar que obtuve la última. Y se aseguró de compilar (lo hizo, el problema era un problema de configuración en la máquina de compilación).

Así que ahora si cambio manualmente el nombre de las carpetas localmente para volver a mi versión, tengo el problema de que TFS cree que tengo la última fuente ... que no. Los archivos fueron cambiados por otro desarrollador pero desde que hice una "Obtener la última versión específica, con sobreescribir" considera que mi código está completamente actualizado.

Preguntas:

  • Se puede de alguna forma 'contar' TFS que mis versiones locales no son tan reciente? (Estoy pensando que podría hacer esto con una utilidad de línea TFS cmd pero no estoy seguro de cuál)

  • ¿Hubo una manera diferente en que debería haber hecho esto?

Gracias.

Respuesta

17

Puede eliminar/eliminar su área de trabajo local.

control de código fuente Explorer -> Espacio de trabajo desplegable -> Áreas de trabajo -> Eliminar

+1

Tenga cuidado de hacer esto, puré de mi TFS – Andy

+0

Después de eliminar el espacio de trabajo existente, configure un nuevo espacio de trabajo que indique la ruta local. Esto funcionó para mí. – Harun

3

En el futuro, en lugar de hacer una copia manual, crear un conjunto de cambios aplazados. En la ventana "cambios pendientes", haga clic en "Detener" y siga el diálogo (en este caso, usted no desea mantener localmente sus cambios pendientes). Esto coloca su trabajo en el servidor en un lugar seguro y recuperable, pero sin registrándolo.

Como alternativa, en el menú desplegable del área de trabajo, puede crear un segundo espacio de trabajo. Eso le da dos copias separadas del código localmente, pero también dos conjuntos separados de cajas. Esto es realmente útil si a menudo te encuentras interrumpiendo una pieza de trabajo para ver otra cosa.

Si realiza otro "obtener específico" con sobreescritura, esto aún debería solucionar su problema.

+0

La opción de crear un segundo espacio de trabajo era exactamente lo que necesitaba. ¡Gracias! –

0

¿Sabe qué archivos han cambiado? ¿Estamos hablando de muchos archivos? ¿O solo unos pocos?

Si solo son unas pocas, solo debe copiar su versión modificada nuevamente y luego volver a sacar los archivos. TFS se registrará luego de haber cambiado esos archivos.

Si tiene muchos archivos modificados, le recomiendo que pruebe Team Foundation Power Tools (tfpt) Online comando "Línea de comando".

La Ayuda de línea de comandos se puede ver here.

Aquí alguna información más de Buck Hodges:

Online 

With Team Foundation, a server connection is necessary to check files in or out, to delete files, to rename files, etc. The TFPT online tool makes it easier to work without a server connection for a period of time by providing functionality that informs the server about changes made in the local workspace. 

Non-checked-out files in the local workspace are by default read-only. The user is expected to check out the file with the tf checkout command before editing the file. When working in this 

When working offline with the intent to sync up later by using the TFPT online tool, users must adhere to a strict workflow: 

    * Users without a server connection manually remove the read-only flag from files they want to edit. Non-checked-out files in the local workspace are by default read-only, and when a server connection is available the user must check out the file with the tf checkout command before editing the file. When working offline, the DOS command “attrib –r” should be used. 
    * Users without a server connection add and delete files they want to add and delete. If not checked out, files selected for deletion will be read-only and must be marked as writable with “attrib –r” before deleting. Files which are added are new and will not be read-only. 
    * Users must not rename files while offline, as the TFPT online tool cannot distinguish a rename from a deletion at the old name paired with an add at the new name. 
    * When connectivity is re-acquired, users run the TFPT online tool, which scans the directory structure and detects which files have been added, edited, and deleted. The TFPT online tool pends changes on these files to inform the server what has happened. 

To invoke the TFPT online tool, execute 

tfpt online 

at the command line. The online tool will begin to scan your workspace for writable files and will determine what changes should be pended on the server. 

By default, the TFPT online tool does not detect deleted files in your local workspace, because to detect deleted files the tool must transfer significantly more data from the server. To enable the detection of deleted files, pass the /deletes command line option. 

When the online tool has determined what changes to pend, the Online window is displayed. 

Individual changes may be deselected here if they are not desired. When the Pend Changes button is pressed, the changes are actually pended in the workspace. 

Important Note: If a file is edited while offline (by marking the file writable and editing it), and the TFPT online tool pends an edit change on it, a subsequent undo will result in the changes to the file being lost. It is therefore not a good idea to try pending a set of changes to go online, decide to discard them (by doing an undo), and then try again, as the changes will be lost in the undo. Instead, make liberal use of the /preview command line option (see below), and pend changes only once. 

Preview Mode 

The Online window displayed above is a graphical preview of the changes that will be pended to bring the workspace online, but a command-line version of this functionality is also available. By passing the /preview and /noprompt options on the command line, a textual representation of the changes that the TFPT online tool thinks should be pended can be displayed. 

tfpt online /noprompt /preview 

Inclusions 

The TFPT online tool by default operates on every file in the workspace. Its focus can be more directed (and its speed improved) by including only certain files and folders in the set of items to inspect for changes. Filespecs (such as *.c, or folder/subfolder) may be passed on the command line to limit the scope of the operation, as in the following example: 

tfpt online *.c folder\subfolder 

This command instructs the online tool to process all files with the .c extension in the current folder, as well as all files in the folder\subfolder folder. No recursion is specified. With the /r (or /recursive) option, all files matching *.c in the current folder and below, as well as all files in the folder\subfolder folder and below will be checked. To process only the current folder and below, use 

tfpt online . /r 

Exclusions 

Many build systems create log files and/or object files in the same directory as source code which is checked in. It may become necessary to filter out these files to prevent changes from being pended on them. This can be achieved through the /exclude:filespec1,filespec2,… option. 

With the /exclude option, certain filemasks may be filtered out, and any directory name specified will not be entered by the TFPT online tool. For example, there may be a need to filter out log files and any files in object directories named “obj”. 

tfpt online /exclude:*.log,obj 

This will skip any file matching *.log, and any file or directory named obj. 
+0

Solo un pequeño comentario a este. Si simplemente revisara todos los archivos, vuelva a verificarlos. Cuando ingresa, TFS compara los valores hash de los archivos con las versiones anteriores y solo incluirá los archivos que han cambiado en su conjunto de cambios. Así que esa podría ser la forma más sencilla de recuperar en esta instancia si todavía no tiene instaladas las herramientas TFS Power Tools en su máquina. –

15

Si recibe la versión específica de cambios para "Revisión 1" de su código fuente, TFS eliminará los archivos locales, y se cree que ya no tiene el último código en su espacio de trabajo. Luego, cuando consigas una última actualización, en realidad recibirás la última.

+1

Ese es uno de los mejores trucos que he escuchado en mucho tiempo, ¡funciona muy bien también! Es posible que deba ingresar y limpiar los archivos que no estaban en TFS (carpetas bin, etc.) también. –

+0

Esto es útil para los casos en que necesito tener varias ramas en un área de trabajo, pero no quiero los archivos la mayoría de las veces (como para las fusiones). – NextInLine

+1

Aquí hay un post que describe esta Nota http://stackoverflow.com/questions/19785117/delete-local-folder-in-tfs que no está en busca de un conjunto de cambios llamado "Revisión 1", sino un conjunto de cambios nombrado "1" – user2023861

0

Estoy usando un truco para abrir la solución sin conexión de red (desenchufar el cable, apagar el wifi) y la solución se abrirá en modo fuera de línea.

También hay un plugin llamado "desconectarse" para eso.

Y luego, hacer clic en "ir en línea", que se muestra de forma automática, en caso de que la solución fuera de línea.

Después de esto, VS verificará todos sus archivos locales contra TFS y revisará automáticamente los archivos que se cambiaron.

Pero para su caso, también sugeriría utilizar shelvesets.

0

en TFS 2013+ y 2015+ VS usted tiene la opción Capa que borra los archivos locales y capas aquellas ramas de conseguir descargado en el espacio de trabajo local (básicamente unmaps ramas específicas)

Cuestiones relacionadas