Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 55 additions & 55 deletions book/09-git-and-other-scms/sections/client-tfs.asc
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
==== Git and TFS
==== Git y TFS

(((Interoperation with other VCSs, TFS)))
(((TFS)))((("TFVC", see="TFS")))
Git is becoming popular with Windows developers, and if you're writing code on Windows, there's a good chance you're using Microsoft's Team Foundation Server (TFS).
TFS is a collaboration suite that includes defect and work-item tracking, process support for Scrum and others, code review, and version control.
There's a bit of confusion ahead: *TFS* is the server, which supports controlling source code using both Git and their own custom VCS, which they've dubbed *TFVC* (Team Foundation Version Control).
Git support is a somewhat new feature for TFS (shipping with the 2013 version), so all of the tools that predate that refer to the version-control portion as ``TFS'', even though they're mostly working with TFVC.
Git se está volviendo popular entre los desarrolladores de Windows, y si estás escribiendo códigos en Windows, hay muchas posibilidades de que estés usando Team Foundation Server (TFS) de Microsoft.
TFS es un paquete de colaboración que incluye seguimiento de defectos y elementos de trabajo, soporte de procesos para Scrum y otros, revisión de código y control de versiones.
Hay un poco de confusión por delante: * TFS * es el servidor, que admite controlar el código fuente utilizando tanto Git como su propio VCS personalizado, al que han denominado * TFVC * (Team Foundation Version Control).
El soporte de Git es una característica algo nueva para TFS (envío con la versión de 2013), por lo que todas las herramientas anteriores a eso se refieren a la porción de control de versión como `` TFS '', aunque en su mayoría funcionan con TFVC.

If you find yourself on a team that's using TFVC but you'd rather use Git as your version-control client, there's a project for you.
Si se encuentra en un equipo que usa TFVC pero prefiere usar Git como su cliente de control de versiones, hay un proyecto para usted.

===== Which Tool
===== Cual herramienta

(((git-tf)))(((git-tfs)))
In fact, there are two: git-tf and git-tfs.
De hecho, hay dos: git-tf y git-tfs.

Git-tfs (found at https://github.com/git-tfs/git-tfs[]) is a .NET project, and (as of this writing) it only runs on Windows.
To work with Git repositories, it uses the .NET bindings for libgit2, a library-oriented implementation of Git which is highly performant and allows a lot of flexibility with the guts of a Git repository.
Libgit2 is not a complete implementation of Git, so to cover the difference git-tfs will actually call the command-line Git client for some operations, so there are no artificial limits on what it can do with Git repositories.
Its support of TFVC features is very mature, since it uses the Visual Studio assemblies for operations with servers.
This does mean you'll need access to those assemblies, which means you need to install a recent version of Visual Studio (any edition since version 2010, including Express since version 2012), or the Visual Studio SDK.
Git-tfs (encontrado en https://github.com/git-tfs/git-tfs []) es un proyecto .NET, y (al momento de escribir esto) solo se ejecuta en Windows.
Para trabajar con repositorios Git, utiliza los enlaces .NET para libgit2, una implementación de Git orientada a la biblioteca que es altamente eficiente y permite mucha flexibilidad con las agallas de un repositorio Git.
Libgit2 no es una implementación completa de Git, por lo que para cubrir la diferencia, git-tfs realmente llamará al cliente Git de la línea de comandos para algunas operaciones, por lo que no hay límites artificiales sobre lo que puede hacer con los repositorios Git.
Su compatibilidad con las características de TFVC es muy madura, ya que utiliza los ensamblados de Visual Studio para operaciones con servidores.
Esto significa que necesitará acceso a esos ensamblados, lo que significa que necesita instalar una versión reciente de Visual Studio (cualquier edición desde la versión 2010, incluido Express desde la versión 2012) o el SDK de Visual Studio.

Git-tf (whose home is at https://gittf.codeplex.com[]) is a Java project, and as such runs on any computer with a Java runtime environment.
It interfaces with Git repositories through JGit (a JVM implementation of Git), which means it has virtually no limitations in terms of Git functions.
However, its support for TFVC is limited as compared to git-tfs – it does not support branches, for instance.
Git-tf (cuyo domicilio se encuentra en https://gittf.codeplex.com []) es un proyecto de Java y, como tal, se ejecuta en cualquier computadora con un entorno de tiempo de ejecución de Java.
Interactúa con los repositorios de Git a través de JGit (una implementación JVM de Git), lo que significa que prácticamente no tiene limitaciones en términos de funciones de Git.
Sin embargo, su soporte para TFVC es limitado en comparación con git-tfs; por ejemplo, no admite sucursales.

So each tool has pros and cons, and there are plenty of situations that favor one over the other.
We'll cover the basic usage of both of them in this book.
Entonces, cada herramienta tiene ventajas y desventajas, y hay muchas situaciones que favorecen a una sobre la otra.
Cubriremos el uso básico de ambos en este libro.

[NOTE]
[NOTA]
====
You'll need access to a TFVC-based repository to follow along with these instructions.
These aren't as plentiful in the wild as Git or Subversion repositories, so you may need to create one of your own.
Codeplex (https://www.codeplex.com[]) or Visual Studio Online (http://www.visualstudio.com[]) are both good choices for this.
Necesitará acceder a un repositorio basado en TFVC para seguir estas instrucciones.
Estos no son tan abundantes en la naturaleza como los repositorios de Git o Subversion, por lo que puede necesitar crear uno propio.
Codeplex (https://www.codeplex.com []) o Visual Studio Online (http://www.visualstudio.com []) son buenas opciones para esto.
====


===== Getting Started: `git-tf`
===== Comenzando con: `git-tf`

The first thing you do, just as with any Git project, is clone.
Here's what that looks like with `git-tf`:
Lo primero que haces, al igual que con cualquier proyecto de Git, es clonar.
Esto es lo que parece con `git-tf`:

[source,console]
----
$ git tf clone https://tfs.codeplex.com:443/tfs/TFS13 $/myproject/Main project_git
----

The first argument is the URL of a TFVC collection, the second is of the form `$/project/branch`, and the third is the path to the local Git repository that is to be created (this last one is optional).
Git-tf can only work with one branch at a time; if you want to make checkins on a different TFVC branch, you'll have to make a new clone from that branch.
El primer argumento es la URL de una colección TFVC, el segundo es de la forma `$ / project / branch`, y el tercero es la ruta al repositorio Git local que se va a crear (este último es opcional).
Git-tf solo puede funcionar con una rama a la vez; si quieres hacer checkins en una rama diferente de TFVC, tendrás que hacer un nuevo clon desde esa rama.

This creates a fully functional Git repository:
Esto crea un repositorio de Git completamente funcional:

[source,console]
----
Expand All @@ -57,10 +57,10 @@ $ git log --all --oneline --decorate
512e75a (HEAD, tag: TFS_C35190, origin_tfs/tfs, master) Checkin message
----

This is called a _shallow_ clone, meaning that only the latest changeset has been downloaded.
TFVC isn't designed for each client to have a full copy of the history, so git-tf defaults to only getting the latest version, which is much faster.
Esto se denomina clon _shallow_, lo que significa que solo se ha descargado el último conjunto de cambios.
TFVC no está diseñado para que cada cliente tenga una copia completa del historial, por lo que git-tf usa de manera predeterminada la última versión, que es mucho más rápida.

If you have some time, it's probably worth it to clone the entire project history, using the `--deep` option:
Si tiene algo de tiempo, probablemente valga la pena clonar todo el historial del proyecto, usando la opción `--deep`:

[source,console]
----
Expand All @@ -80,14 +80,14 @@ d44b17a (HEAD, tag: TFS_C35190, origin_tfs/tfs, master) Goodbye
Team Project Creation Wizard
----

Notice the tags with names like `TFS_C35189`; this is a feature that helps you know which Git commits are associated with TFVC changesets.
This is a nice way to represent it, since you can see with a simple log command which of your commits is associated with a snapshot that also exists in TFVC.
They aren't necessary (and in fact you can turn them off with `git config git-tf.tag false`) git-tf keeps the real commit-changeset mappings in the `.git/git-tf` file.
Observe las etiquetas con nombres como `TFS_C35189`; esta es una característica que te ayuda a saber qué compromisos de Git están asociados con los conjuntos de cambios de TFVC.
Esta es una buena forma de representarlo, ya que puede ver con un comando de registro simple cuál de sus confirmaciones está asociado con una instantánea que también existe en TFVC.
No son necesarios (y, de hecho, puedes desactivarlos con `git config git-tf.tag false`) - git-tf conserva las asignaciones reales commit-changeset en el archivo` .git / git-tf`.


===== Getting Started: `git-tfs`
===== Comenzando: `git-tfs`

Git-tfs cloning behaves a bit differently.
La clonación de Git-tfs se comporta de forma un poco diferente.
Observe:

[source,powershell]
Expand All @@ -105,11 +105,11 @@ C17 = d202b53f67bde32171d5078968c644e562f1c439
C18 = 44cd729d8df868a8be20438fdeeefb961958b674
----

Notice the `--with-branches` flag.
Git-tfs is capable of mapping TFVC branches to Git branches, and this flag tells it to set up a local Git branch for every TFVC branch.
This is highly recommended if you've ever branched or merged in TFS, but it won't work with a server older than TFS 2010 – before that release, ``branches'' were just folders, so git-tfs can't tell them from regular folders.
Observe el indicador `--with-branches`.
Git-tfs es capaz de mapear ramas de TFVC a ramas de Git, y este indicador le dice que configure una rama local de Git para cada rama de TFVC.
Esto es muy recomendable si alguna vez se ha bifurcado o se ha fusionado en TFS, pero no funcionará con un servidor anterior a TFS 2010; antes de esa versión, `` branches '' eran solo carpetas, por lo que git-tfs no puede decir ellos de las carpetas regulares.

Let's take a look at the resulting Git repository:
Echemos un vistazo al repositorio Git resultante:

[source,powershell]
----
Expand All @@ -128,19 +128,19 @@ Date: Fri Aug 1 03:41:59 2014 +0000
git-tfs-id: [https://username.visualstudio.com/DefaultCollection]$/myproject/Trunk;C16
----

There are two local branches, `master` and `featureA`, which represent the initial starting point of the clone (`Trunk` in TFVC) and a child branch (`featureA` in TFVC).
You can also see that the `tfs` ``remote'' has a couple of refs too: `default` and `featureA`, which represent TFVC branches.
Git-tfs maps the branch you cloned from to `tfs/default`, and others get their own names.
Hay dos ramas locales, `master` y` featuresS`, que representan el punto inicial inicial del clon (`Trunk` en TFVC) y una rama secundaria (` featureS` en TFVC).
También puede ver que el `tfs`` `remote '' también tiene un par de referencias:` default` y `featureA`, que representan las ramas de TFVC.
Git-tfs mapea la rama desde la que clonaste a `tfs / default`, y otras obtienen sus propios nombres.

Another thing to notice is the `git-tfs-id:` lines in the commit messages.
Instead of tags, git-tfs uses these markers to relate TFVC changesets to Git commits.
This has the implication that your Git commits will have a different SHA-1 hash before and after they have been pushed to TFVC.
Otra cosa a notar es las líneas `git-tfs-id:` en los mensajes de confirmación.
En lugar de etiquetas, git-tfs usa estos marcadores para relacionar los conjuntos de cambios de TFVC con las confirmaciones de Git.
Esto tiene la consecuencia de que tus confirmaciones de Git tendrán un hash SHA-1 diferente antes y después de que se hayan enviado a TFVC.

===== Git-tf[s] Workflow
===== Git-tf [s] Flujo de trabajo

[NOTE]
[NOTA]
====
Regardless of which tool you're using, you should set a couple of Git configuration values to avoid running into issues.
Independientemente de la herramienta que esté utilizando, debe establecer un par de valores de configuración de Git para evitar problemas.

[source,console]
----
Expand All @@ -149,13 +149,13 @@ $ git config set --local core.autocrlf=false
----
====

The obvious next thing you're going to want to do is work on the project.
TFVC and TFS have several features that may add complexity to your workflow:
Lo siguiente obvio que querrás hacer es trabajar en el proyecto.
TFVC y TFS tienen varias características que pueden agregar complejidad a su flujo de trabajo:

. Feature branches that aren't represented in TFVC add a bit of complexity.
This has to do with the *very* different ways that TFVC and Git represent branches.
. Be aware that TFVC allows users to ``checkout'' files from the server, locking them so nobody else can edit them.
This obviously won't stop you from editing them in your local repository, but it could get in the way when it comes time to push your changes up to the TFVC server.
. Las ramas de características que no están representadas en TFVC agregan un poco de complejidad.
Esto tiene que ver con las * muy * diferentes formas en que TFVC y Git representan ramas.
. Tenga en cuenta que TFVC permite a los usuarios "verificar" los archivos del servidor, bloqueándolos para que nadie más pueda editarlos.
Obviamente, esto no le impedirá editarlos en su repositorio local, pero podría interferir cuando llegue el momento de enviar sus cambios al servidor TFVC.
. TFS has the concept of ``gated'' checkins, where a TFS build-test cycle has to complete successfully before the checkin is allowed.
This uses the ``shelve'' function in TFVC, which we don't cover in detail here.
You can fake this in a manual fashion with git-tf, and git-tfs provides the `checkintool` command which is gate-aware.
Expand Down