Get specific version from source control - Mercurial

gvar369gvar369 Posts: 20

How can I update my database schema to a specific version from the source control. I only see option to update to the latest version.

Source Control version:
Linked to: Mercurial

Let me know if any other information is required related to this question.



  • James BJames B Posts: 1,124 Silver 4
    Thanks for your post.

    Currently with Mercurial, we don't offer any of the historical revision options (unlike TFS / SVN) - this is because we are currently simply calling the hg command-line as opposed to having any more indepth integration.

    I guess you can work around the issue by using your usual Mercurial client to update your working folder to the revision you want, and then doing a "Get Latest". I'd also ask you to vote up the suggestion for better Mercurial support, here
    Systems Software Engineer

    Redgate Software

  • Thanks for the reply.
    I tried using the Mercurial client to update my working folder to the version I needed. But when i tried to get latest, Redgate Source Control would switch back mercurial to the latest version, instead of the version i need.

    For ex: My latest version number is 17 and i need to get the code from version 10. I would switch to version 10 in the mercurial client. Later when open get latest tab in Redgate Source control, it doesn't show any of the database schema of version 10. I went back into the mercurial client to check if there were any actual changes in that version. What I observed was that mercurial switched to the latest version 17.

    I believe get latest in Redgate Source Control is always looking for the latest version (i.e 17)

    Could you suggest any workaround for this.

  • James BJames B Posts: 1,124 Silver 4
    I think this is because our Get Latest command will call "hg update" with no other parameter, which I think updates you to the latest revision.

    You can create your own commandlinehooks file (Mercurial2) by creating a copy of the Mercurial one in c:\users\-your username-\appdata\local\red gate\commandlinehooks, and editing it to:

    - change the name to Mercurial2 as well
    - remove the "hg update" in the Get Latest part.

    Then, unlink your DB, and relink picking the Mercurial2 that should be on the list. When you then Get Latest (after still manually going to revision 10) you should find we don't revert it back to head.

    Note, you do need to make a copy of the file and edit it rather than editing an existing one, to avoid your changes being overwritten.
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.