0

This is NOT another what are bookmarks/what are branches question - I have read all of these posts and now want to clarify some things about correct usage.

I am developing a website. I want a stable version, and a development version.

So I create two bookmarks 'stable', and 'development'.

If i want to create a new feature I update to the development bookmark, and create my feature.

If i want to correct a typo I do it directly in the stable version.

My confusion is as follows. I have a central repository at bitbucket.

If i use hg push my bookmark data is not passed. If i do hg push -B stable or hg push -B development respectively then my bookmark data is pushed.

I then have two servers, a testing server and a live server. If I ssh onto the server and do a hg pull from bitbucket because the bookmarks are not present on the server, what is pulled, and what then is the working copy updated to when I use hg update?

The correct usage for what I want, I believe is as follows. A local repository with my two bookmarks 'stable' and 'development'. I switch between the two as required and push them to bitbucket with hg push -B bookmark-name. Then I login to my testing/live server respectively and pull the correct bookmarked version.

Once I have tested my development bookmark I can merge it with my stable one and pull it onto the live server.

My concern and as such my question is what happens If i accidentally forget to specify the bookmark when pulling to the live server for example?

Thanks

Thomas Clowes
  • 4,529
  • 8
  • 41
  • 73

3 Answers3

1

Pulling

From Mercurial 2.3, pulling gets the remote repository's bookmarks as well. Before, you had to specify -B <bookmark> to get bookmarks as well as changesets. So your server repositories will have the right bookmarks after pulling.

If you're using an earlier version, you'll have to pull -B <bookmark> to get the bookmark as well. Of course, you can do that anyway, if you'd prefer not to pull all development changesets onto your live server.

Updating

Using hg update with no arguments will get you tip, which is always the last changeset added to the repository, whether that's stable, development or accidentally un-bookmarked (actually, it'll get you the last changeset added to the current branch, but it sounds like you're not using named branches). To get consistent results when updating, I'd recommend you be explicit about which bookmark you want each server repository to update to. If you're worried about forgetting to specify, use scripts to automate your update process.

anton.burger
  • 5,637
  • 32
  • 48
1

The correct usage IMHO is to use named branch instead of bookmark.

0

I treat bookmarks as local tags and no more. So if I'm wanting to push tagging information then I use actual tags to mark stable releases. Every time I do a release I mark it such as "rel-2.4" for example.

Then on live I can update to the latest revision and know that that is the last good release. My "dev" is simply the head of the default branch and I keep adding new bits of development into it. This way you can just do a push and not worry about the bookmarks.

This might not be what you want or you envisage but it is a workable solution for the situation you describe.

Should we have a fix that we need to do (a typo in your example) I can update to the last release, correct the type, test and if happy tag it as the next release (rel-2.41). Merge that new branch back into default so my dev branch has the fix too. Jump on the live server and pull/update to rel-2.41

Is that any good to you?

Pete Duncanson
  • 3,208
  • 2
  • 25
  • 35