Issue #202 resolved

Link to tip version of source files

Eirik Stavem
created an issue

From Christos Τrochalakis (ctrochalakis):

It would make sense if we could use urls that always point to the tip version of the source files.

something like: http://www.bitbucket.org/ctrochalakis/tx-submissions/tip/README

Comments (15)

  1. Christos Trochalakis

    I was thinking about this issue, I believe there are two, kind of different things, that need to addressed:

    But when viewing http://www.bitbucket.org/ctrochalakis/tx-submissions/src/2e567e30060b/ the file links should probably be /src/2e567e30060b/myfile

  2. Jesper Nøhr

    We don't have a translation map yet, i.e. if you view a rev that's actually tip, it will stills how the rev hash, but I think there are certain dangers to doing that, like if you are viewing a file and a newer version gets committed, it will change the file once you reload the page.

    If you really want this behavior, feel free to replace the rev hash with 'tip' in the url yourself, should yield the same results. I'm keeping it resolved for now. Re-open if further discussion is needed.

  3. Anonymous

    like if you are viewing a file and a newer version gets committed, it will change the file once you reload the page.

    Yes, you are correct, but I suspect that this behavior would be perfectly normal. You are viewing the tip version of a file, tip can change anytime. What I am saying is that semantics are correct.

    But that's probably a matter of taste :)

    Thanks for resolving this Jesper :)

  4. Jesper Nøhr

    Yes, you are correct, but I suspect that this behavior would be perfectly normal. You are viewing the tip version of a file, tip can change anytime. What I am saying is that semantics are correct.

    Yes, I agree that it's expected behavior, but I think one should "choose" this behavior by manually updating the URL. More often than not, someone will click on a file that just so happened to be updated in tip, and expect the page he's on to be retained.

    It's a perfectly valid case that you want to "follow" a file by having 'tip' in the URL, but as I said, it should be chosen, not default behavior.

  5. tora

    I have a problem with the current behavior.

    User Scenario
    1. hg push
    2. confirm a url: https://bitbucket.org/<account>/<repository>/src/<changeset>/<path>/
    3. substitute changeset with tip: https://bitbucket.org/<account>/<repository>/src/tip/<path>/
    4. announce the substituted url to the people
    5. they access to the url and browse some files.
    6. they bookmark the url on their web browser: https://bitbucket.org/<account>/<repository>/src/<changeset>/..., instead of /tip/
    7. hg ci; hg push
    8. they access to the site with their bookmark and find nothing new.
    9. hg ci; hg push
    10. they access to the site with their bookmark and find nothing new.
    Problem

    With that user scenario, they will never get the latest files unless I bother them with annoying, frequent announcements.

    I know a way to get the tip. It is to substitute 'changeset' with 'tip' in the url. They, or most of them, however, do not know about it.

  6. tora

    There is a similar problem with Internet search engines.

    User Scenario
    1. search for some useful source codes with Internet search engines.
    2. click on the url suggested by the engine. It might be https://bitbucket.org/<account>/<repository>/src/<changeset>/<path>/
    3. look into the files that are the ones scrawled by the engine several days or months ago.
    Proposal
    1. It would be better if there was an instant way to get the tip on the page https://bitbucket.org/<account>/<repository>/src/<changeset>/<path>/
    2. It world be also better if the site did not alter the portion '/tip/' with '/<changeset>/' in case of the url including /tip/
  7. Drew Noakes

    This thread is the first hit on Google when trying to achieve this, so here's an explanation of the URL pattern I found to work.

    The URL for a particular version of a resource follows the pattern:

    https://bitbucket.org/<user>/<repo>/raw/<sha1>/<path>/<filename.ext>
    

    For a Git repository, replace <sha1> with the branch name (i.e. master) to see the version at that branch.

    For Mercurial, do the same, but use tip (apparently -- I haven't tested this.)

  8. Chris Beck

    You can also use a relative URL to link between your wiki pages and the source with just

    ../<src || raw>/<tree-ish>/<path>/<filename.ext>
    

    where tree-ish can be a commit_id, branch, etc

    (Thanks Arjan & Drew)

  9. Log in to comment