Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of TFS repositories on self-hosted Azure Devops #8

Open
brumartins opened this issue Dec 3, 2020 · 8 comments
Open

Support of TFS repositories on self-hosted Azure Devops #8

brumartins opened this issue Dec 3, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@brumartins
Copy link

Hello everyone 👋

Your VS extension seems to be exactly what I've been looking for... so cool to get an url pointing to a file of your code when you need to share something with a colleague! 👍

I've installed the extension, but I get no additional entry in my Windows context menu to copy the link. We have no Git but TFS repositories. Self-hosted Azure Devops. Maybe that's because (self hosted) TFS repositories are not supported?

Thank you in advance 😀
Bruno

@veler veler added the enhancement New feature or request label Dec 3, 2020
@veler
Copy link
Owner

veler commented Dec 3, 2020

Hi,

Thanks for your feedback. TFS isn't supported at all. Self-hosted Azure DevOps Git server should be supported, that said, I haven't been able to test it otherwise than unit tests because I don't have any under the hand.

I'll try to look for the TFS support. Meanwhile, can you please share an anonymous TFS repository URL that look like the one of your repository? That would help me to verify that the URL is parsed correctly.

Thank you in advance 😊

@brumartins
Copy link
Author

For self-hosted Azure, the remote URL of a Git repository is :
http://yourserver:8080/tfs/YourCollection/YourProject/_git/YourProject

For a TFS repository, I'm not sure as my knowledge of the CLI is very poor. The Git URL above show the files of the codebase. So with the same logic, for a TFS repo, the URL might be :
http://yourserver:8080/tfs/YourCollection/YourProject/_versionControl

Good luck if you keep digging into TFS support, especially with the branch system being a total mess in my opinion 😫

Thanks!

@veler
Copy link
Owner

veler commented Dec 3, 2020

Thanks :) I'll try to look at this.

@dlyz
Copy link

dlyz commented Dec 9, 2021

Hi! We are using self-hosted Azure DevOps Server 2020 Update 1.

Currently the extension (in VS2022) generates URL in form of:

http://my.domain:8080/tfs/CollectionName/_git/_git/?path=valid/path/and/other/params

But the working one is:

http://my.domain:8080/tfs/CollectionName/ProjectName/_git/RepositoryName?path=valid/path/and/other/params

I think, the problem is here. Apparently it does not consider CollectionName.

As I understand, the raw URL of the repository is taken from the .git/config file. In my .git/config file origin remote URL is exactly:

http://my.domain:8080/tfs/CollectionName/ProjectName/_git/RepositoryName

So the valid code would be:

properties[Organization] = repositoryUri.Host;
properties[Collection] = repositoryUri.Segments[2].TrimEnd('/');
properties[Project] = repositoryUri.Segments[3].TrimEnd('/');
properties[Repository] = repositoryUri.Segments[5].TrimEnd('/');
properties[OrganizationUrl] = $"{repositoryUri.Scheme}://{repositoryUri.Authority}/tfs/";
properties[RepositoryUrl] = $"{properties[OrganizationUrl]}{properties[Collection]}/{properties[Project]}/_git/{properties[Repository]}/";
// or even simpler and universal
properties[RepositoryUrl] = repositoryUri.ToString() + "/";

@veler
Copy link
Owner

veler commented Dec 9, 2021

Hi @dlyz ,

Thank you for sharing this. I still don't have a self-hosted AzDO Server and still can't verify it by myself.
I built a new extension package that includes your suggested changes here : https://1drv.ms/u/s!AtZ0bJ-3VAYrga-TNYscev_5AFsFI9s?e=4wOSu9
Would you please be able to give it a try on VS 2022?
To do it, you will need to:

  1. Uninstall the existing extension from VS 2022 (note that the package I shared isn't compatible with VS 2019).
  2. Install the new one by downloading and double-clicking the .vsix file I shared above.

@brumartins , Hi :) Would you be able to test it too by any chance?

Thank you very much for your help! I really appreciate :)

@dlyz
Copy link

dlyz commented Dec 9, 2021

Thank you for quick response! I checked it and it works for me just fine.

There is one minor remark though. Currently the file opens, but the tree view does not show current file. If I add to the path parameter prefix / (%2F), tree view works as expected. So it will be perfect if you add this prefix probably here like this:

string url = $"{repositoryUrl}?path=/{relativePath.TrimStart('/')}&version=GC{commitId}&lineStyle=plain";

But it should be checked for cloud AzDO, I don't know, will it work there or not.

@veler
Copy link
Owner

veler commented Dec 10, 2021

Thank you @dlyz ! I pushed my changes with your latest proposal and I'm currently publishing the newest extension package on the VS Marketplace :) https://marketplace.visualstudio.com/items?itemName=EtienneBAUDOUX.CopyGitLink2022 version 1.4.4

You might need to uninstall the package I sent earlier and install it again from the Extensions menu in Visual Studio to make sure you get future updates.

Thank you again for your help with this ! I will keep this issue opened since it still doesn't cover TFS version control.

@brumartins
Copy link
Author

Hi @veler, I've changed job and I'm no more working with a self-hosted Azure DevOps so I can't help anymore. But I can see things worked out, big thanks to both of you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants