Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS web portal: Possible to link/URI directly to line number in file?

I would like to send my coworkers a link directly to a line number in a file in our TFS repo. Is this possible? If so, how? We are using TFS 2015.


Currently, the best way I have found is to link to the file like so:

http[s]://{TFS-SERVER}[:{PORT}]/tfs/{PROJECT-COLLECTION}/_versionControl#path={PATH-TO-FILE}

Then, Ctrl+G to manually enter the line number. Before I dig through the JavaScript to find how Ctrl+G works, I am hoping someone can help me out.


I have tried variations on this theme, but without sucecss:

http[s]://{TFS-SERVER}[:{PORT}]/tfs/{PROJECT-COLLECTION}/_versionControl#path={PATH-TO-FILE}#line={LINE}


P.S. My issue is similar to this issue but rather than for Visual Studio, I am looking for a link via the TFS web portal.

like image 711
skataben Avatar asked Apr 01 '16 14:04

skataben


2 Answers

Once you select a piece of code in VSO code editor, it is possible to copy a link to that section (see picture below). It looks like TFS has pretty similar url structure, maybe it will work.

Generated link structure

https://{PROJECT_URL}/_versionControl?path={FILE_PATH}&line={SELECTION_START_LINE}&lineEnd={SELECTION_END_LINE}&lineStartColumn={SELECTION_START_COLUMN}&lineEndColumn={SELECTION_END_COLUMN}


vso code editor

like image 188
igorushi Avatar answered Nov 13 '22 02:11

igorushi


Just heard from a guy inside of Microsoft that adding &line=5should work. My local tests show it only works for Visual Studio team Services and doesn't work on TFS 2015 update 2. You'll probably have to wait until update 3 for this feature to hit TFS.

In the mean time, the JavaScript simply looks for a div with the right linenumber attribute:

<div linenumber="5">...</div>
like image 30
jessehouwing Avatar answered Nov 13 '22 00:11

jessehouwing