1. Bitbucket Website
  2. Public Issue Tracker
  3. master

Issues

Issue #9206 closed

Add a link to latest version of file (using branch name, not SHA1 in the URL) (BB-10307)

Denis Kuzmin
created an issue

In addition to #202

Add button for convenience - see example in attach

Currently for getting url needs to do the following steps (exaggerate):

  • Copy link to src or raw
https://bitbucket.org/<user>/<repo>/src/<sha1>/<path>/<file>
  • to type branch-name instead of sha1
  • Share link
  • find a typo :) again..

I think it would be helpful

Comments (13)

  1. Erik van Zijst staff

    We deliberately put the SHA1 in the URL instead of the branch name, to give you an immutable resource (otherwise we could have just landed you at ../master/..). As such, any quick share button would likely also contain that SHA1 and not the branch name.

    Also, what would the button choose if the SHA1 you are looking at exists on multiple branches?

  2. Denis Kuzmin reporter

    We deliberately put the SHA1 in the URL instead of the branch name, to give you an immutable resource

    Yes, that should be by default! However, sometimes needed to the latest version for the selected branch! e.g.:

    • link to the current rev
    • link to the latest version

    Also, what would the button choose if the SHA1 you are looking at exists on multiple branches?

    the button(s) should apply only to the current selected branch. Otherwise we will be getting something problems or other difficulties...

    In general it should be a simple share [ raw/src -> latest/current ]

    by the way.. also would be nice if selected line(i.e. #cl-7) also be highlighted

  3. Erik van Zijst staff

    You don't always have a branch selected. If you simply go to https://bitbucket.org/<user>/<repo>/src/<sha1>/<path>/<file> there is no branch context. In that case, what should the button link to?

  4. Denis Kuzmin reporter

    file should be displayed by default from selected branch in settings repo, right ?

    • Repository settings -> Repository details -> Main branch

    see: https://bitbucket.org/3F/vssolutionbuildevent/src/114607fdb953cc8686a31cd9bba7e86c3cb447ff/vsSolutionBuildEvent/IMSBuildProperty.cs

    should be from master


    ..another interesting

    We deliberately put the SHA1 in the URL instead of the branch name

    example of ambiguity:

    same sha1 for different branch - "?at=deprecated"

    https://bitbucket.org/3F/vssolutionbuildevent/src/114607fdb953cc8686a31cd9bba7e86c3cb447ff/vsSolutionBuildEvent/IMSBuildProperty.cs?at=deprecated

  5. Erik van Zijst staff

    file should be displayed by default from selected branch in settings repo, right ?

    A file might only exist on a specific feature branch and be absent in the master branch.

    I'll raise an internal issue so that the subject will get discussed before we make a decision on this.

  6. Denis Kuzmin reporter

    A file might only exist on a specific feature branch and be absent in the master branch.

    yep, like above was an example of ambiguity. File must be absent for selected "deprecated":

    and so

    • the link couldn't be obtained by user if it is absent in the selected branch (it exists if we are on the page with the source file)
    • if file later was removed for selected branches.. as now - 404, etc.,

    I'll raise an internal issue so that the subject will get discussed before we make a decision on this.

    ok

  7. farvardin

    It seems we can no longer replace the shasum by "master" to get the latest version of the file. If we do this we get a "Oops, you've found a dead link.". It works some weeks ago.

    Example: https://bitbucket.org/hlabrand/extensions-i6/src/956c3a73e0a9ca589d4d49439dbb528382f88d1a/French.h?at=master&fileviewer=file-view-default => https://bitbucket.org/hlabrand/extensions-i6/src/master/French.h

    it worked as of 25th may 2016.

    Being able to display (always) the latest revision of a file is very useful.

  8. Log in to comment